Amaimersion / remove-files-webpack-plugin

A plugin for webpack that removes files and folders before and after compilation.

Home Page:https://www.npmjs.com/package/remove-files-webpack-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Files not being removed, unsafe to remove warning in terminal

JonnyPS opened this issue · comments

I have installed @1.2.1 to my dev dependencies, and have a simple setup whereby I want to remove some surplus files created when I run yarn build .

This gives the following warning in the terminal:

remove-files-plugin@1.2.1:
Skipped, because unsafe removing – "/build/assets/js/legacy.js"
An items for removing in trash not found

My webpack setup looks like this:

new RemovePlugin({
            before: {
              include: [
                  'build' // remove the build folder before compiling
              ]
            },
            after: { 
              log: true,
              include: [
                'build/assets/js/legacy.js'
              ]
            }
        }),

Why does the warning appear and how can it be overwritten?

Update: I have solved this, I had to set the allowRootAndOutside to be true.
Suggestion: It would be helpful if the warning message hinted that this might be the thing blocking the action.

Hello!

The issue related to bug which have been fixed recently in 1.2.2 (#16). So, please upgrade to 1.2.2 and remove allowRootAndOutside: true because it is temporary fix.

Suggestion: It would be helpful if the warning message hinted that this might be the thing blocking the action.

Good suggestion. Probably i will implement this.

👍 Cool, thanks @Amaimersion