A webpack loader for parsing JSON5 files into JavaScript objects. Supports modern JSON5 syntax including comments, trailing commas, and unquoted keys. Current stable version is 4.0.1 (released October 2020), requiring Node.js >= 10.13 and webpack ^4 || ^5. Replaced the built-in json-loader for JSON5 support. Key differentiator: integrates seamlessly with webpack's module system, offering esModule option for ES module output and enabling tree shaking. Maintained by the webpack-contrib organization with regular updates to schema-utils.
npm install json5-loaderVerified import paths — ran on the pinned version, not inferred.
Shows how to configure webpack to load JSON5 files with json5-loader and import the parsed object.
Upgrade Node.js to version >= 10.13.0
Set `esModule: false` in loader options if you need CommonJS output
Upgrade Node.js or use earlier loader version
Add `type: 'javascript/auto'` to the loader rule
Use configuration-based rules instead of inline loader syntax
Add `type: 'javascript/auto'` to the loader rule in webpack.config.js
Run `npm install json5-loader --save-dev`