Webpack Clean- /public/js has been removed

时间:2017-04-06 16:51:08

标签: javascript plugins npm webpack

I am using the clean-webpack-plugin to clean out my public/js folder.

https://www.npmjs.com/package/clean-webpack-plugin

I have tried everything but always get a /public/js has been removed

plugins: [
new CleanWebpackPlugin(['js/'], {
            root: '/public',
            verbose: true,
            dry: false,
            exclude: ['360.jpg']
    }),

1 个答案:

答案 0 :(得分:1)

尝试删除root: '/public',键值并从['js/']

中删除正斜杠

如果您的设置中确实需要root键,请确保它是绝对路径:

root: __dirnameroot: "E:/node_projects/my_project",

使用这些设置插件对我有用:

new CleanWebpackPlugin(['dist'], {
    //root: '/',
    verbose: true,
    dry: false,
    exclude: ['example.txt']
}),

我的项目设置:

enter image description here

这是我的控制台输出:

enter image description here