webpack.05-Output输出配置
文章目录
https://www.webpackjs.com/con...
cnpm init -ycnpm 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"
}
}
未完待续...
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论