webpack-08-多页面应用打包

多页应用打包

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: 'development',
entry: {
home: './src/index.js',
other: './src/other.js'
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist'),
},
plugins: [
new HtmlWebpackPlugin({
filename: 'home.html',
src: path.resolve(__dirname, 'index.html'),
chunks: ['home']
}),
new HtmlWebpackPlugin({
filename: 'other.html',
src: path.resolve(__dirname, 'index.html'),
chunks: ['other']
})
]
}
0%