remove strip-json-comments and switch to json5
This commit is contained in:
parent
2a2c67ad26
commit
3d8c0fe0f8
@ -55,6 +55,7 @@
|
||||
"home-or-tmp": "^1.0.0",
|
||||
"is-integer": "^1.0.4",
|
||||
"js-tokens": "1.0.1",
|
||||
"json5": "^0.4.0",
|
||||
"line-numbers": "0.2.0",
|
||||
"lodash": "^3.10.0",
|
||||
"minimatch": "^2.0.3",
|
||||
@ -70,7 +71,6 @@
|
||||
"slash": "^1.0.0",
|
||||
"source-map": "^0.4.0",
|
||||
"source-map-support": "^0.2.10",
|
||||
"strip-json-comments": "^1.0.2",
|
||||
"to-fast-properties": "^1.0.0",
|
||||
"trim-right": "^1.0.0",
|
||||
"try-resolve": "^1.0.0"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { validateOption, normaliseOptions } from "./index";
|
||||
import stripJsonComments from "strip-json-comments";
|
||||
import json5 from "json5";
|
||||
import isAbsolute from "path-is-absolute";
|
||||
import pathExists from "path-exists";
|
||||
import clone from "lodash/lang/clone";
|
||||
@ -58,10 +58,10 @@ export default class OptionManager {
|
||||
var opts;
|
||||
|
||||
try {
|
||||
opts = jsonCache[content] = jsonCache[content] || JSON.parse(stripJsonComments(content));
|
||||
opts = jsonCache[content] = jsonCache[content] || json5.parse(content);
|
||||
if (key) opts = opts[key];
|
||||
} catch (err) {
|
||||
err.message = `${loc}: ${err.message}`;
|
||||
err.message = `${loc}: Error while parsing JSON - ${err.message}`;
|
||||
throw err;
|
||||
}
|
||||
|
||||
@ -178,7 +178,9 @@ export default class OptionManager {
|
||||
}
|
||||
|
||||
// resolve all .babelrc files
|
||||
this.findConfigs(opts.filename);
|
||||
if (opts.babelrc !== false) {
|
||||
this.findConfigs(opts.filename);
|
||||
}
|
||||
|
||||
// merge in env
|
||||
var envKey = process.env.BABEL_ENV || process.env.NODE_ENV || "development";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user