const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
mode: 'development',
entry: {
index1: {
import: ['./src/index.js', './src/index3.js'],
dependOn: 'lodash',
filename: 'bundle1/index.js'
},
index2: {
import: './src/index2.js',
filename: 'bundle2/index.js'
},
lodash: {
import: 'lodash',
filename: 'common/lodash.js'
}
},
plugins: [
new HtmlWebpackPlugin({
title: '多页面1', // <%= htmlWebpackPlugin.title %>
template: './src/index.html',
inject: 'body',
filename: 'bundle1/index.html',
chunks: ['index1','lodash'],
publicPath: 'http://www.aa.com/'
}),
new HtmlWebpackPlugin({
title: '多页面2',
template: './src/index2.html',
inject: 'body',
filename: 'bundle2/index.html',
chunks: ['index2'],
publicPath: 'http://www.bb.com/'
})
],
output: {
clean: true
}
}