diff --git a/dist/server/config.js b/dist/server/config.js index 1b9670c35244..f0d0abe3378f 100644 --- a/dist/server/config.js +++ b/dist/server/config.js @@ -18,9 +18,9 @@ exports.default = function (baseConfig, configDir) { // if user has a .babelrc file in current directory // use that to extend webpack configurations if (_fs2.default.existsSync('./.babelrc')) { - var content = _fs2.default.readFileSync('./.babelrc'); + var content = _fs2.default.readFileSync('./.babelrc', 'utf-8'); try { - var babelrc = JSON.parse(content); + var babelrc = _cjson2.default.parse(content); config.module.loaders[0].query = babelrc; } catch (e) { logger.error('=> Error parsing .babelrc file: ' + e.message); @@ -65,6 +65,10 @@ var _path = require('path'); var _path2 = _interopRequireDefault(_path); +var _cjson = require('cjson'); + +var _cjson2 = _interopRequireDefault(_cjson); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // avoid ESLint errors diff --git a/package.json b/package.json index b1cdcbfca18d..f11cc0bf854c 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "babel-preset-react": "^6.3.13", "babel-preset-stage-2": "^6.3.13", "babel-runtime": "^6.3.14", + "cjson": "^0.4.0", "commander": "^2.9.0", "expect": "^1.6.0", "express": "^4.13.3", diff --git a/src/server/config.js b/src/server/config.js index 9581461e8eac..2be900af9404 100644 --- a/src/server/config.js +++ b/src/server/config.js @@ -1,5 +1,6 @@ import fs from 'fs'; import path from 'path'; +import cjson from 'cjson'; // avoid ESLint errors const logger = console; @@ -13,9 +14,9 @@ export default function (baseConfig, configDir) { // if user has a .babelrc file in current directory // use that to extend webpack configurations if (fs.existsSync('./.babelrc')) { - const content = fs.readFileSync('./.babelrc'); + const content = fs.readFileSync('./.babelrc', 'utf-8'); try { - const babelrc = JSON.parse(content); + const babelrc = cjson.parse(content); config.module.loaders[0].query = babelrc; } catch (e) { logger.error(`=> Error parsing .babelrc file: ${e.message}`);