Webpack Clean- /public/js has been removed

Go To StackoverFlow.com

2

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']
    }),
2017-04-06 16:51
by LeBlaireau


1

Try removing your root: '/public', key value and remove forward slash from ['js/']

if you really need a root key in your settings, make sure it is an absolute path:

root: __dirname or root: "E:/node_projects/my_project",

Plugin does work for me with these settings:

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

My project setup:

enter image description here

Here is my console output:

enter image description here

2017-04-06 17:24
by loelsonk