- 信息提示
webpack --config webpack/webpack.config.js
The CLI moved into a separate package: webpack-cli
Would you like to install webpack-cli? (That will run npm install -D webpack-cli) (yes/NO)
解决方式
npm i -D webpack-cli
npm i -g webpack-cli
-S, --save: Package will appear in your dependencies.
-D, --save-dev: Package will appear in your devDependencies.
-O, --save-optional: Package will appear in your optionalDependencies.
- 提示信息
WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
You can also set it to 'none' to disable any default behavior.
解决方式
package.json 文件
"scripts": {
"start": "webpack-dev-server",
"dev": "webpack --mode development",
"build": "webpack --mode production"
}