
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
remove-files-webpack-plugin
Advanced tools
A plugin for webpack which removes files and folders before and after compilation.
A plugin for webpack which removes files and folders before and after compilation.
npm
:npm install remove-files-webpack-plugin
Yarn
:yarn add remove-files-webpack-plugin
const RemovePlugin = require('remove-files-webpack-plugin');
module.exports = {
plugins: [
new RemovePlugin({
before: {
// parameters.
},
after: {
// parameters.
}
})
]
}
Be aware! You cannot undo deletion of folders or files. Use the emulate
option if you not sure about correctness of the parameters.
Name | Type | Default | Description |
---|---|---|---|
root | String | . | A root directory. Not absolute paths will be appended to this. Defaults to from which directory is called. |
include | Array<String> | [] | A folders or files for removing. |
exclude | Array<String> | [] | A files for excluding. |
test | Array<TestObject> | [] | A folders for custom testing. |
TestObject.folder | String | Required | A path to the folder. |
TestObject.method | (filePath: String) => Boolean | Required | A method that accepts an absolute file path and must return boolean value that indicates should be removed that file or not. |
TestObject.recursive | Boolean | false | Test in all subfolders, not just in TestObject.folder . |
log | Boolean | true | Print which folders or files has been removed. |
emulate | Boolean | false | Emulate remove process. Print which folders or files will be removed without actually removing them. Ignores log value. |
allowRootAndOutside | Boolean | false | Allow remove of a root directory or outside the root directory. It's kinda safe mode. Don't turn it on, if you don't know what you actually do! |
You can pass the options into both before
and after
keys. Each key is optional, but at least one should be specified.
before
- executes before compilation;after
- executes after compilation.const RemovePlugin = require('remove-files-webpack-plugin');
module.exports = {
plugins: [
new RemovePlugin({
/**
* Before compilation removes entire `dist` folder.
*/
before: {
include: ['dist']
},
/**
* After compilation removes all files in `dist/styles` folder,
* that have `.map` type.
*/
after: {
test: [
{
folder: 'dist/styles',
method: (filePath) => {
return new RegExp(/\.map$/, 'm').test(filePath);
}
}
]
}
})
]
}
new RemovePlugin({
/**
* Before compilation removes entire `dist` folder.
*/
before: {
include: ['dist']
},
/**
* After compilation removes all css maps
* in `dist/styles` folder except `popup.css.map` file.
*/
after: {
exclude: ['dist/styles/popup.css.map'],
test: [
{
folder: 'dist/styles',
method: (filePath) => {
return new RegExp(/\.map$/, 'm').test(filePath);
}
}
]
}
})
new RemovePlugin({
/**
* After compilation removes all css maps in
* `dist/styles` folder and all subfolders
* (e.g. `dist/styles/header`).
*/
after: {
test: [
{
folder: 'dist/styles',
method: (filePath) => {
return new RegExp(/\.map$/, 'm').test(filePath);
},
recursive: true
}
]
}
})
new RemovePlugin({
/**
* Before compilation removes `manifest.json` file and
* removes `js` folder.
*/
before: {
root: './dist',
include: ['manifest.json', 'js']
}
})
new RemovePlugin({
/**
* After compilation:
* - removes all css maps in `dist/styles` folder.
* - removes all js maps in `dist/scripts` folder and
* all subfolders (e.g. `dist/scripts/header`).
*/
after: {
root: './dist',
test: [
{
folder: './styles',
method: (filePath) => {
return new RegExp(/\.map$/, 'm').test(filePath);
}
},
{
folder: './scripts',
method: (filePath) => {
return new RegExp(/\.js.map$/, 'm').test(filePath);
},
recursive: true
}
]
}
})
Feel free to use issues. Pull requests are also always welcome!
1.1.1 (March 20, 2019)
Nothing changed. Had to change the version because of problems with npm
. See changelog for 1.1.0 version.
FAQs
A plugin for webpack that removes files and folders before and after compilation.
The npm package remove-files-webpack-plugin receives a total of 22,096 weekly downloads. As such, remove-files-webpack-plugin popularity was classified as popular.
We found that remove-files-webpack-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.