Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cjson for .babelrc parsing #98

Merged
merged 1 commit into from
Apr 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions dist/server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions src/server/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import cjson from 'cjson';

// avoid ESLint errors
const logger = console;
Expand All @@ -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}`);
Expand Down