webpack笔记
程序员文章站
2022-07-12 19:53:06
...
1.安装
2.遇到的报错
CleanWebpackPlugin is not a constructor报错
解决代码:
const path = require('path');
// 生成html
const HtmlWebpackPlugin = require('html-webpack-plugin');
// 清理
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
module.exports = {
entry: {
app: './src/index.js',
print: './src/print.js'
},
plugins: [
// 清理
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
title: 'Output Management'
})
],
output: {
filename: '[name].bundle.js',
path: path.resolve(__dirname, 'dist')
}
};
上一篇: Webpack 笔记
下一篇: Webpack笔记