Permalink
Browse files

Update Babel config (#3703)

* Update Babel config

* Update for Babel 6.13.2

* Lint all the things

* __DEV__ is a non-writable global
  • Loading branch information...
1 parent eda7d47 commit b01a258d12b50a184f9e225536de4a2bdfc0fc4c @taion taion committed with timdorr Aug 9, 2016
Showing with 32 additions and 21 deletions.
  1. +5 −6 .babelrc
  2. +1 −1 .eslintrc
  3. +7 −9 package.json
  4. +7 −5 scripts/build.js
  5. +12 −0 tools/es2015Preset.js
View
@@ -1,17 +1,16 @@
{
- "presets": ["react"],
+ "presets": [
+ "./tools/es2015Preset",
+ "stage-1",
+ "react"
+ ],
"plugins": ["dev-expression"],
"env": {
"cjs": {
- "presets": ["es2015-loose", "stage-1"],
"plugins": ["add-module-exports"]
},
- "es": {
- "presets": ["es2015-loose-native-modules", "stage-1"]
- },
"test": {
- "presets": ["es2015-loose", "stage-1"],
"plugins": ["istanbul"]
}
}
View
@@ -1,7 +1,7 @@
{
"extends": ["rackt", "plugin:react/recommended"],
"globals": {
- "__DEV__": true
+ "__DEV__": false
},
"rules": {
"react/display-name": 0,
View
@@ -18,10 +18,10 @@
"build": "npm run build-cjs && npm run build-es",
"build-cjs": "rimraf lib && cross-env BABEL_ENV=cjs babel ./modules -d lib --ignore '__tests__'",
"build-es": "rimraf es6 && cross-env BABEL_ENV=es babel ./modules -d es6 --ignore '__tests__'",
- "build-umd": "cross-env BABEL_ENV=cjs NODE_ENV=development webpack modules/index.js umd/ReactRouter.js",
- "build-min": "cross-env BABEL_ENV=cjs NODE_ENV=production webpack -p modules/index.js umd/ReactRouter.min.js",
- "lint": "eslint modules examples *.js",
- "start": "cross-env BABEL_ENV=cjs node examples/server.js",
+ "build-umd": "cross-env NODE_ENV=development webpack modules/index.js umd/ReactRouter.js",
+ "build-min": "cross-env NODE_ENV=production webpack -p modules/index.js umd/ReactRouter.min.js",
+ "lint": "eslint examples modules scripts tools *.js",
+ "start": "node examples/server.js",
"test": "npm run lint && npm run test-node && npm run test-browser",
"test-browser": "cross-env NODE_ENV=test karma start",
"test-node": "cross-env NODE_ENV=test mocha --compilers js:babel-register tests.node.js"
@@ -43,17 +43,15 @@
},
"devDependencies": {
"babel-cli": "^6.11.4",
- "babel-core": "^6.11.4",
+ "babel-core": "^6.13.2",
"babel-eslint": "^6.1.2",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-dev-expression": "^0.2.1",
"babel-plugin-istanbul": "^1.0.3",
- "babel-preset-es2015": "^6.9.0",
- "babel-preset-es2015-loose": "^7.0.0",
- "babel-preset-es2015-loose-native-modules": "^1.0.0",
+ "babel-preset-es2015": "^6.13.2",
"babel-preset-react": "^6.11.1",
- "babel-preset-stage-1": "^6.5.0",
+ "babel-preset-stage-1": "^6.13.0",
"babel-register": "^6.11.6",
"bundle-loader": "^0.5.4",
"codecov": "^1.0.1",
View
@@ -1,10 +1,12 @@
-var execSync = require('child_process').execSync
-var readFileSync = require('fs').readFileSync
-var prettyBytes = require('pretty-bytes')
-var gzipSize = require('gzip-size')
+/* eslint-disable no-console */
+
+const execSync = require('child_process').execSync
+const readFileSync = require('fs').readFileSync
+const prettyBytes = require('pretty-bytes')
+const gzipSize = require('gzip-size')
function exec(command) {
- execSync(command, { stdio: [0, 1, 2] })
+ execSync(command, { stdio: [ 0, 1, 2 ] })
}
exec('npm run build')
View
@@ -0,0 +1,12 @@
+const { buildPreset } = require('babel-preset-es2015')
+
+const { BABEL_ENV } = process.env
+
+module.exports = {
+ presets: [
+ [ buildPreset, {
+ loose: true,
+ modules: BABEL_ENV === 'es' ? false : 'commonjs'
+ } ]
+ ]
+}

0 comments on commit b01a258

Please sign in to comment.