Precautions: 1. Webpack do not install in the global environment, in which project to use, it is installed under the project can
1. Question one: After NPM init Initializes a project, add the Webpack.config.js file and install the NPM package under the project with NPM install Webpack--save-dev,
Then execute the webpack command at the root of the project to report the following error
Cause: Although Webpack is installed in the project, execution of webpack execution at the root of the project is still global Webpack the error is due to the fact that Webpack is not installed globally. 、
Solution: Wrap the Webpack "start" in the script script in Pacage.json: "Webpack" and then execute NPM run start at the root of the project.
Question: Why does it have to be in NPM scripts to use the local Package command?
1. The Webpack in the project is not global, so it is not possible to execute the Webpack.
The NPM Start command in 2.NPM script first finds the Webpack package in this project, executes it, finds it, and continues to find it, and so on.
3. It's a good idea to use NPM script to wrap node's CLI
Webpack beginners to trample the pit to remember