Skip to content

Does not ignore deleting files outside of the root  #73

@rw3iss

Description

@rw3iss

I'm trying to prevent the plugin from removing a specific file in an output directory above the current context. This seems to work if it's within the current context, but not in a parent or adjacent folder. Here is my config:

 new CleanWebpackPlugin(['build/*', '../api/build/*'],{
            root:     path.resolve(__dirname), // set root to parent so we can clean ../api/build/
            allowExternal: true,
            exclude:  ['app.js'],
            verbose:  true,
            dry:      false,
            watch: true
}),

There is the file 'app.js' within '../api/build/' that it keeps deleting. I have also tried to put the full path of the file, ie: path.resolve(__dirname, '../api/build') + '/app.js' and similar things, but can't prevent it from deleting.

I've also tried just making a separate plugin definition for the parent folder, but it seems to still delete it, oddly:

new CleanWebpackPlugin(['build/**.js'],{
            root:     path.resolve(__dirname, '../api'), // set root to parent so we can clean ../api/build/
            exclude:  ['app.js'],
            verbose:  true,
            watch: true
}),

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions