Skip to content

Commit

Permalink
failing on npm run build, Unknown option: direct.presets
Browse files Browse the repository at this point in the history
  • Loading branch information
bdefore committed Dec 20, 2015
1 parent c8940fb commit cbcb6ba
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 68 deletions.
34 changes: 15 additions & 19 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
{
"stage": 0,
"optional": "runtime",
"loose": "all",
"plugins": [
"typecheck"
],
"env": {
"development": {
"plugins": [
"react-transform"
],
"extra": {
"react-transform": {
"transforms": [{
"transform": "react-transform-catch-errors",
"imports": [
"react",
"redbox-react"
]
}]
}
}
[
"react-transform", {
"transforms": [{
"transform": "react-transform-hmr",
"imports": ["react"],
"locals": ["module"]
}, {
"transform": "react-transform-catch-errors",
"imports": ["react", "redbox-react"]
}]
}
],
[ "transform-runtime" ],
[ "typecheck" ]
]
}
}
}
2 changes: 1 addition & 1 deletion bin/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
require('../server.babel'); // babel registration (runtime transpilation for node)
// require('../server.babel'); // babel registration (runtime transpilation for node)

var webpack = require('webpack');
var webpackConfig = require('./merge-configs');
Expand Down
2 changes: 1 addition & 1 deletion bin/local-dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ compile() {
cp $ROOT_DIR/.babelrc $PROJECT_PATH/node_modules/universal-redux
cp $ROOT_DIR/.eslintrc $PROJECT_PATH/node_modules/universal-redux
cp $ROOT_DIR/server.babel.js $PROJECT_PATH/node_modules/universal-redux
babel $ROOT_DIR/src/ -d $PROJECT_PATH/node_modules/universal-redux/lib > /dev/null
babel $ROOT_DIR/src/ --presets es2015,stage-0,react --plugins transform-runtime --out-dir $PROJECT_PATH/node_modules/universal-redux/lib > /dev/null
echo Update complete, continuing to watch...
}

Expand Down
2 changes: 1 addition & 1 deletion bin/server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
require('../server.babel'); // babel registration (runtime transpilation for node)
// require('../server.babel'); // babel registration (runtime transpilation for node)

var path = require('path');
var renderer = require('../lib/server');
Expand Down
2 changes: 1 addition & 1 deletion bin/webpack-dev-server.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
require('../server.babel'); // babel registration (runtime transpilation for node)
// require('../server.babel'); // babel registration (runtime transpilation for node)

var path = require('path');
var Express = require('express');
Expand Down
41 changes: 5 additions & 36 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require('babel/polyfill');
// require('babel/polyfill');

// begin shared setup
var path = require('path');
Expand All @@ -10,48 +10,17 @@ var assetsPath = path.join(__dirname, relativeAssetsPath);
var fs = require('fs');
var host = (process.env.HOST || 'localhost');
var port = parseInt(process.env.PORT) + 1 || 3001;
var babelrc = fs.readFileSync(path.resolve(__dirname, '..', './.babelrc'));
var babelrcObject = {};

// begin prod setup
var CleanPlugin = require('clean-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var strip = require('strip-loader');

var babelConfig = 'babel-loader?presets[]=es2015,presets[]=stage-0,presets[]=react'
if (process.env.NODE_ENV !== 'production') {

try {
babelrcObject = JSON.parse(babelrc);
} catch (err) {
console.error('==> ERROR: Error parsing your .babelrc.');
console.error(err);
}

var babelrcObjectDevelopment = babelrcObject.env && babelrcObject.env.development || {};
var babelLoaderQuery = Object.assign({}, babelrcObject, babelrcObjectDevelopment);
delete babelLoaderQuery.env;

babelLoaderQuery.plugins = babelLoaderQuery.plugins || [];
if (babelLoaderQuery.plugins.indexOf('react-transform') < 0) {
babelLoaderQuery.plugins.push('react-transform');
}

babelLoaderQuery.extra = babelLoaderQuery.extra || {};
if (!babelLoaderQuery.extra['react-transform']) {
babelLoaderQuery.extra['react-transform'] = {};
}
if (!babelLoaderQuery.extra['react-transform'].transforms) {
babelLoaderQuery.extra['react-transform'].transforms = [];
}
babelLoaderQuery.extra['react-transform'].transforms.push({
transform: 'react-transform-hmr',
imports: ['react'],
locals: ['module']
});

var jsLoaders = ['babel?' + JSON.stringify(babelLoaderQuery)];
var jsLoaders = [babelConfig];
} else {
var jsLoaders = [strip.loader('debug'), 'babel'];
var jsLoaders = [strip.loader('debug'), babelConfig];
}

module.exports = {
Expand All @@ -67,7 +36,7 @@ module.exports = {
},
module: {
loaders: [
{ test: /\.jsx?$/, exclude: /node_modules/, loaders: jsLoaders},
{ test: /\.jsx?$/, exclude: /node_modules/, loaders: jsLoaders },
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
{ test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
Expand Down
21 changes: 13 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,26 @@
],
"main": "lib/index.js",
"scripts": {
"compile": "babel src/ -d lib/",
"compile": "babel src/ --out-dir lib/",
"dev": "./bin/local-dev.sh",
"prepublish": "npm run compile",
"lint": "eslint -c .eslintrc src",
"test": "karma start"
},
"dependencies": {
"autoprefixer-loader": "^3.1.0",
"babel": "~5.8.29",
"babel-core": "~5.8.33",
"babel-eslint": "^4.1.3",
"babel-loader": "~5.3.3",
"babel-plugin-react-transform": "~1.1.1",
"babel-plugin-typecheck": "^2.0.0",
"babel-runtime": "~5.8.29",
"babel": "~6.3.13",
"babel-cli": "6.3.17",
"babel-core": "~6.3.21",
"babel-eslint": "^5.0.0-beta3",
"babel-loader": "~6.2.0",
"babel-plugin-react-transform": "~2.0.0-beta1",
"babel-plugin-transform-runtime": "^6.3.13",
"babel-plugin-typecheck": "^3.5.1",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13",
"babel-runtime": "~6.3.19",
"bootstrap-sass": "^3.3.5",
"bootstrap-sass-loader": "^1.0.9",
"clean-webpack-plugin": "^0.1.4",
Expand Down
1 change: 0 additions & 1 deletion src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* THIS IS THE ENTRY POINT FOR THE CLIENT, JUST LIKE server.js IS THE ENTRY POINT FOR THE SERVER.
*/
// node modules dependencies
import 'babel/polyfill';
import React from 'react';
import { each } from 'lodash';
import ReactDOM from 'react-dom';
Expand Down

0 comments on commit cbcb6ba

Please sign in to comment.