Local execution webpack

1 is performed locally performed at .bin directory webpack

  1. Package.json generated file in the root directory: npm init

  2. 安装webapck npm install webpack --save-dev

  3. Creating webpack.config.js file: echo> webpack.config.js

4, simple configuration webpack.config.js

5.cmd input webpack command, cake, error (webpack not internal commands)

Niche thought of compiling a folder is .bin,

Go to the bin folder, enter webpack being given that the lack of webpack-cli

Thus niche obediently installed npm install webpack-cli --save-dev

The D: \ try \ webpack \ node_modules.bin set environment variables became (to My Computer - Properties - Advanced System Settings - environment variables)

Turn off the cmd window re-opens into the project folder, run the command webpack

2, perform configuration package.js

"Scripts": {
"WebPACK": "WebPACK -v"
},
Original: https://blog.csdn.net/weixin_41584401/article/details/82948182
Copyright: This article is a blogger original article, reproduced, please attach Bowen link!

Guess you like

Origin blog.csdn.net/qq_32486011/article/details/89792596