webpack installation and basic use

(CNPM Taobao mirror, may be used directly NPM)
open 1.cmd need to package the folder where the code, such as workCode
2.cnpm the install -g [email protected]
initialized 3. installed, cnpm init (To generate the package .json)
4. installation directory of the project, CNPM install --save-dev WebPACK
5.webpack -v, verify that the installation was successful

Use webpack three
1.wepack a.js -o build.js
2.package.json // omitted knock each path, abbreviated as npm run pack (pack custom fields, may instead be other)
{
"name" : "igloo2",
"version": "2.0.0",
"the Description": "vue.js version",
"main": "index.js",
"scripts": {
"the Test": "echo" Error: Test specified NO "Exit. 1 &&",
"Pack": "the node_modules / .bin / WebPACK common.js -o pack.js"
},
"author": "",
"License": "the ISC",
"devDependencies": {
"WebPACK": "^ 4.41.5"
}
}
3. copy or official website webpack.config.js // entry inlet, output outlet, after configuring
.package.json "pack": "node_modules / .bin / webpack"
run npm run pack

Published 11 original articles · won praise 0 · Views 133

Guess you like

Origin blog.csdn.net/baiyikai/article/details/104712778