Giter Site home page Giter Site logo

Comments (1)

Amaimersion avatar Amaimersion commented on June 8, 2024

I just tested it. For me RemoveFilesPlugin don't follows soft links and don't removes anything that is located at this soft link. Can you provide some reproducible configuration? Here is mine:

test1 folder

~/Downloads/test1$ ls -al
-rw-rw-r-- 1 sergey sergey     0 Dec  8 15:45 test1.txt

test2 folder

~/Downloads/test2$ ls -al
lrwxrwxrwx 1 sergey sergey    28 Dec  8 15:47 test1-link -> /home/sergey/Downloads/test1
-rw-rw-r-- 1 sergey sergey     0 Dec  8 16:31 test2.txt

webpack.config.js

const RemoveFilesPlugin = require('remove-files-webpack-plugin');

module.exports = {
    entry: {
        index: './index.js'
    },
    mode: 'production',
    plugins: [
        new RemoveFilesPlugin({
            before: {
                include: [
                    '/home/sergey/Downloads/test2'
                ],
                allowRootAndOutside: true,
                logDebug: true
            }
        })
    ]
};

part of debug log:

unlink-folder-sync: "test1-link" converted to "/home/sergey/Downloads/test2/test1-link"
unlink-folder-sync: "test2.txt" converted to "/home/sergey/Downloads/test2/test2.txt"
unlink-folder-sync: Skipped, because of invalid stat – "/home/sergey/Downloads/test2/test1-link"
unlink-folder-sync: File permanently removed – /home/sergey/Downloads/test2/test2.txt
unlink-folder-sync: ENOTEMPTY: directory not empty, rmdir '/home/sergey/Downloads/test2'

As you can see, test1-link wasn't touched at all. So, original ~/Downloads/test1 wasn't affected also.

It is a content of folders after removing:

~/Downloads/test2$ ls -al
lrwxrwxrwx 1 sergey sergey    28 Dec  8 15:47 test1-link -> /home/sergey/Downloads/test1
~/Downloads/test1$ ls -al
-rw-rw-r-- 1 sergey sergey     0 Dec  8 15:45 test1.txt

It is similar to rm -rf with one exception that test1-link wasn't removed (just test1-link should be removed, not it content).

from remove-files-webpack-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.