共计 667 个字符,预计需要花费 2 分钟才能阅读完成。
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"
}
}
未完待续 …
正文完
发表至: javascript
2020-05-31