npm init
初始化 生成pack.json
npm install webpack webpack-cli —save-dev
安装webpack和webapck-cli
创建项目结构
product
|- package.json
|- src
|-asset
|- main.js
|- dist
|- index.html
output
filename
使用入口名称
module.exports = {output: {filename:"[name].bundle.js"}}
使用内部 chunk id
module.exports = {output: {filename:"[id].bundle.js"}}
使用由生成内容产生的hash
module.exports = {output: {filename:"[contenthash].bundle.js"}}
output.path
output路径对应一个绝对路径
const path = require('path');moudule.exports = {output:{filename: "js/[contenthash].bundle.js",path :path.resolve(__dirname,'dist')}}
