const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { CleanWebpackPlugin } = require("clean-webpack-plugin")
module.exports = {
entry: {
index: './src/index.js',
other: './src/other.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: "[name].js"
},
plugins: [
new CleanWebpackPlugin({
paths: path.resolve(__dirname, 'dist'),
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src/index.html'),
filename: 'index.html',
hash: true,
title: 'index页面',
chunks: ['index']
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'src/other.html'),
filename: 'other.html',
hash: true,
title: 'other页面',
chunks: ['other']
})
]}