1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > 关于报错clean-webpack-plugin:E:\workspace\ar\dist is outside of the project root. Skipping...

关于报错clean-webpack-plugin:E:\workspace\ar\dist is outside of the project root. Skipping...

时间:2022-12-06 11:54:45

相关推荐

关于报错clean-webpack-plugin:E:\workspace\ar\dist is outside of the project root. Skipping...

1.问题

webpack配置:

new CleanWebpackPlugin(['../dist'])//这里我的webpack配置和dist不在同级目录

运行会报错:

clean-webpack-plugin: E:\workspace\test\dist is outside of the project root. Skipping…

2.clean-webpack-plugin介绍

用法

new CleanWebpackPlugin(paths [, {options}])

Paths (必须)

一个数组,数组的每一个元素为要删除的路径

例如:[‘dist’,‘build’]

Options 和默认 (Optional)

{"root":"[webpack.config的地址]",// 一个根的绝对路径."verbose": true,// 将log写到 console."dry": false,// 不要删除任何东西,主要用于测试."exclude": ["files","to","ignore"]//排除不删除的目录,主要用于避免删除公用的文件}

3.问题解决

这里是root参数不准确导致的,可以通过如下配置解决这个问题

new CleanWebpackPlugin(['dist'], {root: path.resolve(__dirname, '../'), //根目录//其他配置按需求添加})

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。