webpack 打包报错 The 'mode' option has not been set, webpack will fallback to 'production' for,Module not found: Error: Can't resolve,WARNING in configuration
Operating environment:
- windows
- nodejs v10.15.3
- webpack v4.38.0
I first global installed webpack and webpack-cli:
A closer look at the official website webpack manual discovery, starting from 4.0, when you run webpack sure to add parameters --mode Development [Development Environment ] or - the MODE Production's [ production ]:
Without using the configuration file usage
<entry>
A file name or a group is named filename as the starting point of entry to build the project. You can pass multiple entry (each entry load at startup). If you pass a form
<name> = <request>
of key-value pairs, you can create an additional entrance starting point. It will be mapped to the configuration options (configuration option) of theentry
property.
<output>
Path and file name of the bundled file to be saved. It will map to the configuration options
output.path
andoutput.filename
.
Examples
If you have a configuration file ( webpack.config.js ), you can join mode.
success!
Attachment:
Configuration Options
parameter | Explanation | Input Type | Defaults |
---|---|---|---|
--mode | A used model, "development" or "production" among | string |