網(wǎng)站首頁 編程語言 正文
webpack-plugins: plugin的使用 clean-webpack-plugin CleanWebpackPlugin
作者:小強有個dream 更新時間: 2022-04-04 編程語言Usage 用法
NOTE: Node v10+ and webpack v4+ are supported and tested.
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = {
plugins: [
new CleanWebpackPlugin()
],
};
關(guān)于
默認(rèn)情況下,該插件將刪除網(wǎng)頁包輸出中的所有文件。路徑目錄,以及每次成功重建后所有未使用的網(wǎng)頁包資產(chǎn)
options
dry 模擬刪除
verbose 將日志寫入控制臺
cleanStaleWebpackAssets 重建時自動刪除所有未使用的網(wǎng)頁包資產(chǎn)
protectWebpackAssets 不允許刪除當(dāng)前的網(wǎng)頁包資產(chǎn)
cleanOnceBeforeBuildPatterns 在編譯網(wǎng)頁包之前刪除一次文件
cleanAfterEveryBuildPatterns 每次生成(包括監(jiān)視模式)后刪除與此模式匹配的文件。
dangerouslyAllowCleanPatternsOutsideProject 需要顯式設(shè)置dry選項
報錯
clean-webpack-plugin: options.output.path not defined. Plugin disabled…
解決
/webpack.config.js
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = {
output: {
path: __dirname + '/dist'
},
plugins: [
new CleanWebpackPlugin()
]
}
原文鏈接:https://blog.csdn.net/qq_36413371/article/details/123520498
相關(guān)推薦
- 2023-11-14 k8s安裝部署metrics-server;監(jiān)測集群狀況
- 2022-03-28 C語言實現(xiàn)紅黑樹詳細(xì)步驟+代碼_C 語言
- 2022-06-22 C++詳細(xì)分析引用的使用及其底層原理_C 語言
- 2023-04-27 React中關(guān)于render()的用法及說明_React
- 2021-11-25 使用Xshell連接VMware上的Linux虛擬機(圖文步驟)_VMware
- 2022-10-11 C++eof()判斷是否讀取到文件尾
- 2022-08-16 python上下文管理器協(xié)議的實現(xiàn)_python
- 2023-12-24 npm安裝element ui出錯的問題--版本不匹配
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過濾器
- Spring Security概述快速入門
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡單動態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支