标签:png require 头部 mode .config ash new script config
当我们修改带hash的文件并进行打包时,每打包一次就会生成一个新的文件,而旧的文件并没有删除。为了解决这种情况,我们可以使用
clean-webpack-plugin在打包之前将文件先清除,之后再打包出最新的文件
下载插件依赖
npm install --save-dev clean-webpack-plugin配置webpack.config.js
头部引入插件
const CleanWebpackPlugin = require('clean-webpack-plugin');在plugins模块引入
new CleanWebpackPlugin(['build'])运行打包命令
webpack --mode development

Webpack 4 学习11(用clean-webpack-plugin来清除文件)
标签:png require 头部 mode .config ash new script config
原文地址:https://www.cnblogs.com/hunterxing/p/10425303.html