filter-json-loader

0.1.0 • Public • Published

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.

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i filter-json-loader

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

3.6 kB

Total Files

5

Last publish

Collaborators

  • joyarzun