jsonc-loader
The jsonc-loader
resolves import/require()
on a JSONC(or jsonc) file into legit JSON object.
Getting Started
To begin, you'll need to install jsonc-loader
:
$ npm install jsonc-loader --save-dev
Then add the loader to your webpack
config. For example:
harrypotter.jsonc
/** * @description This is a json file describing harrypotter book series, with some comment enabled * @author John Doe */{ "1st": { "name": "Harry Potter and the Sorcerer's Stone" }, // inline comment is also fine "2nd": { "name": "Harry Potter and the Chamber of Secrets" }, "3rd": { "name": "Harry Potter and the Prisoner of Azkaban" }, "4th": { "name": "Harry Potter and the Goblet of Fire" }, "5th": { "name": "Harry Potter and the Order of the Phoenix" }, "6th": { "name": "Harry Potter and the Half-Blood Prince" }, "7th": { "name": "Harry Potter and the Deathly Hallows" }}
webpack.config.js
moduleexports = module: rules: test: /.jsonc$/ use: loader: `jsonc-loader` ;
And run webpack
via your preferred method.
Contributing
Please take a moment to read our contributing guidelines if you haven't yet done so.