webpack-extend-json

1.0.0-beta.13 • Public • Published

Webpack Extend JSON

Webpack loader that enables you to extend JSON file.

Note: this loader is still under development & not ready to be used in production

Getting Started

To begin, you'll need to install webpack-extend-json:

npm install --save-dev webpack-extend-json

Then add the loader to your webpack config for a specific file type. For example:

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.json/i,
        loader: 'webpack-extend-json',
      },
    ],
  },
};

Example

You need to have two keys in your JSON "Extend" key which is the file to the file you want to extend & "data" key which is data in the JSON file

Parent.json

{
  "config1": "value1",
  "config2": "value2",
  "config3": "value3",
  "config4": "value4"
}

Child.json

{
  "extends": "./Parent.json", 
  "data": {
    "config3": "value3 - override",
    "config4": "value4 - override",
    "config5": "value5 - new value",
  }
}

the loaded JSON will look like this

{
  "config1": "value1",
  "config2": "value2",
  "config3": "value3 - override",
  "config4": "value4 - override",
  "config5": "value5 - new value",
}

Contributing

Please take a moment to read our contributing guidelines if you haven't yet done so.

CONTRIBUTING

License

MIT

Package Sidebar

Install

npm i webpack-extend-json

Weekly Downloads

4

Version

1.0.0-beta.13

License

MIT

Unpacked Size

10.2 kB

Total Files

9

Last publish

Collaborators

  • ibrahim-rahhal