filter-json-loader
v0.1.0
Published
A json filter loader for webpack
Downloads
1
Readme
filter-json-loader
filter-json-loader is a tiny webpack json loader to remove properties that are not used but compiled for webpack in the final bundle. It only works for the first level of properties.
Installation
npm install -D filter-json-loader
Usage
module: {
rules: [
{
type: "javascript/auto",
test: /package\.json$/,
use: {
loader: 'filter-json-loader',
options: {
keep: ["name", "version"]
}
}
}
]
}
The result in the final bundle is (not the whole package.json):
e.exports={name:"package-name",version:"2.0.0"}
Options
keep: (array) it only maintains these properties in the bundle.
delete: (array) it deletes these properties in the bundle.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.