Skip to content

Removes whole project when outputpath is rootΒ #183

@thet

Description

@thet

Issue description or question

When using clean-webpack-plugin when webpacks output.path is the project root, everything is blindly deleted including the .git directory.
IMO it should only remove old build assets - I don't know if it's possible to find out which one are build assets and which one are not.

Webpack Config

The config is in webpack/base.config.js.

process.traceDeprecation = true;
const path = require('path');
const webpack = require('webpack');

// plugins
const { CleanWebpackPlugin } = require('clean-webpack-plugin');

module.exports = env => {
    return {
        entry: {
            "bundle": path.resolve(__dirname, "../src/init.js"),
        },
        output: {
            filename: "[name].js",
            path: path.resolve(__dirname, '../'),
        },
        },
        plugins: [
            new CleanWebpackPlugin(),
        ]
    };
};

Environment

  System:
    OS: Linux 5.4 Ubuntu 20.04.1 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Memory: 6.36 GB / 23.39 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 12.16.3 - ~/.nvm/versions/node/v12.16.3/bin/node
    Yarn: 1.22.5 - /home/_thet/data/dev/syslab/REPOS/patternslib/Patterns-es6/node_modules/.bin/yarn
    npm: 6.14.4 - ~/.nvm/versions/node/v12.16.3/bin/npm
  npmPackages:
    clean-webpack-plugin: ^3.0.0 => 3.0.0 
    webpack: ^4.43.0 => 4.44.1 

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