A webpack plugin for removing files and folders before and after compilation. Current stable version is 1.5.0, released 2021-04-12. Supports webpack >= 2.2.0 and Node >= 8.3.0. Ships TypeScript types. Key differentiators: supports before, after, and watch compilation modes; handles symbolic links as ordinary files; works on all OS with platform-specific path handling. Unlike clean-webpack-plugin, it allows granular control over which files to remove and supports watch mode cleanup. Development appears dormant since 2021.
npm install remove-files-webpack-pluginVerified import paths — ran on the pinned version, not inferred.
Demonstrates removing the 'dist' folder before compilation and a 'temp' folder after compilation using the before and after namespaces.
Wrap options in the appropriate namespace: `new RemovePlugin({ before: { include: [...] } })`.Set the `root` option explicitly or use absolute paths.
Explicitly set `root: process.cwd()` if the previous behavior was desired.
Avoid using `allowRoot: true`; ensure `include` and `exclude` paths are subdirectories of `root`.
Wrap options: `new RemovePlugin({ before: { include: ['dist'] } })`.Upgrade to webpack 5 compatible version of the plugin or use webpack 4.
Provide at least one namespace: `new RemovePlugin({ after: { include: [] } })`.