https://www.webpackjs.com/con...

cnpm init -y

cnpm i -D webpack webpack-cli

配置文件webpack.config.js

const path=require('path')module.exports={    entry:{        test:'./src/index.js',        demo:'./src/main.js'    },    mode:'development',    output:{        //hash指定6位        filename:'[name]_[hash:6]_bundle.js',        path:path.join(__dirname,'lib'),        //生成文件:test_6ae182_bundle.js demo_6ae182_bundle.js,        /*静态资源准备放到cdn时候,需要加上前缀,就用publicPath        */        //publicPath:'http://cdn.baidu.com/assets'    }}

配置文件package.json

{  "name": "05",  "version": "1.0.0",  "description": "",  "main": "index.js",  "scripts": {    "build": "webpack --config webpack.config.js"  },  "keywords": [],  "author": "",  "license": "ISC",  "devDependencies": {    "webpack": "^4.43.0",    "webpack-cli": "^3.3.11"  }}

未完待续...