Skip to content

Commit

Permalink
Upgrade to Babel 6
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Mar 5, 2016
1 parent cae74e4 commit 0ed7c38
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": [ "es2015", "stage-1" ]

This comment has been minimized.

Copy link
@taion

taion Apr 3, 2016

Contributor

This configuration breaks require('history/lib/createBrowserHistory'). You need add-module-exports.

Consider also adding transform-es3-* and friends (or else just picking up the airbnb preset) to maximize browser compatibility.

This comment has been minimized.

Copy link
@mjackson

mjackson Apr 4, 2016

Author Member

Huh, good catch. Thanks for the heads up.

}
30 changes: 14 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
"name": "history",
"version": "2.0.1",
"description": "Manage browser history with JavaScript",
"author": "Michael Jackson",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/mjackson/history.git"
},
"files": [
"es6",
"lib",
Expand All @@ -10,38 +16,30 @@
],
"main": "lib/index",
"jsnext:main": "es6/index",
"repository": {
"type": "git",
"url": "https://github.com/mjackson/history.git"
},
"scripts": {
"lint": "eslint modules",
"start": "webpack-dev-server -d --content-base ./ --history-api-fallback --inline modules/index.js",
"build-cjs": "rimraf lib && babel ./modules --stage 0 --loose all --plugins dev-expression -d lib --ignore '__tests__'",
"build-es6": "rimraf es6 && babel ./modules --stage 0 --loose all --plugins dev-expression -d es6 --blacklist=es6.modules --ignore '__tests__'",
"build-cjs": "rimraf lib && babel ./modules -d lib --ignore '__tests__'",
"build-es6": "rimraf es6 && babel ./modules -d es6 --blacklist=es6.modules --ignore '__tests__'",

This comment has been minimized.

Copy link
@taion

taion Mar 9, 2016

Contributor

This doesn't work – you can't just blacklist a transform like this. Take a look at what @gaearon did with Redux per reduxjs/redux#1369. It'd be better to drop the ES module build entirely than the distribute a broken one.

"build-umd": "NODE_ENV=production webpack modules/index.js umd/History.js",
"build-min": "NODE_ENV=production webpack -p modules/index.js umd/History.min.js",
"build": "node ./scripts/build.js",
"release": "node ./scripts/release.js",
"prepublish": "npm run build",
"test": "npm run lint && karma start"
"test": "npm run lint && karma start",
"lint": "eslint modules"
},
"authors": [
"Michael Jackson"
],
"license": "MIT",
"dependencies": {
"deep-equal": "^1.0.0",
"invariant": "^2.0.0",
"query-string": "^3.0.0",
"warning": "^2.0.0"
},
"devDependencies": {
"babel": "^5.8.35",
"babel-core": "^5.8.35",
"babel-cli": "^6.6.5",
"babel-eslint": "^5.0.0",
"babel-loader": "^5.4.0",
"babel-plugin-dev-expression": "^0.1.0",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-stage-1": "^6.5.0",
"eslint": "^2.2.0",
"eslint-config-airbnb": "^6.0.2",
"eslint-plugin-react": "^4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {

module: {
loaders: [
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel?stage=0&loose=all&plugins[]=dev-expression' }
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel' }
]
},

Expand Down

3 comments on commit 0ed7c38

@taion
Copy link
Contributor

@taion taion commented on 0ed7c38 Mar 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to update babel-plugin-dev-expression to sync in the FB Babel 6 version. We should be stripping out warnings in our production builds.

@mjackson
Copy link
Member Author

@mjackson mjackson commented on 0ed7c38 Mar 9, 2016 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taion
Copy link
Contributor

@taion taion commented on 0ed7c38 Mar 9, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.