webpack之clean-webpack-plugin报错
2021-04-21 16:28
标签:file http 报错 gem try index man https 改变 参考:https://www.cnblogs.com/PasserByOne/p/12084323.html clean-webpack-plugin新版使用中报错 由于之前代码示例都被遗留下来,导致 通常,在每次构建前清理 1. 安装 2. 配置文件 webpack之clean-webpack-plugin报错 标签:file http 报错 gem try index man https 改变 原文地址:https://www.cnblogs.com/ceceliahappycoding/p/12248143.html/dist
文件夹相当杂乱。由于配置的改变,webpack 会生成新的文件放置在 /dist
文件夹中,但是 webpack 无法追踪到哪些文件是实际在项目中用到的。/dist
文件夹,是比较推荐的做法,需要借助clean-webpack-plugin。npm install clean-webpack-plugin --save-dev
1 const path = require(‘path‘);
2 const HtmlWebpackPlugin = require(‘html-webpack-plugin‘);
3 + const { CleanWebpackPlugin } = require(‘clean-webpack-plugin‘);
4
5 module.exports = {
6 entry: {
7 app: ‘./src/index.js‘,
8 print: ‘./src/print.js‘
9 },
10 plugins: [
11 + new CleanWebpackPlugin(),
12 new HtmlWebpackPlugin({
13 title: ‘Output Management‘
14 })
15 ],
16 output: {
17 filename: ‘[name].bundle.js‘,
18 path: path.resolve(__dirname, ‘dist‘)
19 }
20 };
上一篇:JS作用域和作用域链
文章标题:webpack之clean-webpack-plugin报错
文章链接:http://soscw.com/index.php/essay/77685.html