webpack学习之output
output是指打包之后的配置
注意事项:
path:需要绝对路径,filename代表输出文件名
const path = require('path');module.exports = {entry: './path/to/my/entry/file.js',output: {path: path.resolve(__dirname, 'dist'),filename: 'my-first-webpack.bundle.js',},
};
当有多个入口起点的时候:则用占位符来确保每个文件具有唯一的名称
module.exports = {entry: {app: './src/app.js',search: './src/search.js',},output: {filename: '[name].js',path: __dirname + '/dist',},
};// 写入到硬盘:./dist/app.js, ./dist/search.js