安装html打包插件
const path = require('path');
const HtmlWebpackPlugin = require(`html-webpack-plugin`)
module.exports = {
entry: path.resolve(__dirname,'src/login/index.js'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: './login/index.js',
clean:true
},
Plugin:[
new HtmlWebpackPlugin({
template:path.resolve(__dirname,`public/login.html`), // 模板文件
filename:path.resolve(__dirname,`dist/login/index.html`) // 输出文件
}
)
]
};