Package Exports
- require-strip-json-comments
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (require-strip-json-comments) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
require-strip-json-comments 
Require .json files with comments.
For advanced JSON syntax I recomend using require-json5, which can load JSON with trailing commas, unquoted keys, hex numbers, comments, and more.
Install
npm i require-strip-json-comments
Usage
- Load a JSON file which contains comments
var requireJSON = require('require-strip-json-comments');
var config = requireJSON("./config.json");
- Parse a JSON string which contains comments
var requireJSON = require('require-strip-json-comments');
var config = requireJSON.parse('{"name": /*a very important option*/ "value"}');
- Replace
require()
require('require-strip-json-comments').replace_require();
var config = require("./config");
- Replace
JSON.parse()
require('require-strip-json-comments').replace_JSON();
var config = JSON.parse('{"name": /*a very important option*/ "value"}');
- Replace
require()
andJSON.parse()
require('require-strip-json-comments').replace();
// ...