Skip to content

Commit

Permalink
feat: upgrade to babel-preset-env
Browse files Browse the repository at this point in the history
Unify babelrc for webpack and cli bundler.
Cleaned up webpack babelrc to use same plugins as other setup.
Add IE10/11 support back to webpack setup as that is what Aurelia claimed to support.

closes #754, #909
  • Loading branch information
3cp committed Aug 18, 2018
1 parent e9c5b2f commit 1afe47f
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 41 deletions.
5 changes: 2 additions & 3 deletions lib/commands/new/buildsystems/cli/transpilers/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = function(project) {

project.addToContent(
ProjectItem.resource('.eslintrc.json', 'content/eslintrc.json'),
ProjectItem.resource('.babelrc.js', 'content/babelrc.js'),
ProjectItem.resource('.babelrc', 'content/babelrc')
).addToTasks(
ProjectItem.resource('transpile.js', 'tasks/transpile.js'),
Expand All @@ -18,10 +19,8 @@ module.exports = function(project) {
'babel-eslint',
'babel-plugin-syntax-flow',
'babel-plugin-transform-decorators-legacy',
'babel-plugin-transform-es2015-modules-amd',
'babel-plugin-transform-es2015-modules-commonjs',
'babel-plugin-transform-flow-strip-types',
'babel-preset-es2015',
'babel-preset-env',
'babel-preset-stage-1',
'babel-polyfill',
'babel-register',
Expand Down
6 changes: 2 additions & 4 deletions lib/commands/new/buildsystems/webpack/transpilers/babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,18 @@ module.exports = function(project) {

project.addToContent(
ProjectItem.resource('.eslintrc.json', 'content/eslintrc.json'),
ProjectItem.resource('.babelrc.js', 'content/babelrc.webpack.js'),
ProjectItem.resource('.babelrc', 'content/babelrc.webpack')
ProjectItem.resource('.babelrc.js', 'content/babelrc.js'),
ProjectItem.resource('.babelrc', 'content/babelrc')
).addToDevDependencies(
'babel-eslint@7.2.3',
'eslint@3.19.0',
'babel-loader',
'babel-core',
'babel-plugin-syntax-flow',
'babel-plugin-transform-class-properties',
'babel-plugin-transform-decorators-legacy',
'babel-plugin-transform-flow-strip-types',
'babel-polyfill',
'babel-preset-env',
'babel-preset-es2015',
'babel-preset-stage-1',
'babel-register',
'babel-plugin-istanbul'
Expand Down
4 changes: 0 additions & 4 deletions lib/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,10 @@
"babel-loader": "^7.1.4",
"babel-plugin-istanbul": "^4.1.5",
"babel-plugin-syntax-flow": "^6.18.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-es2015-modules-amd": "^6.24.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-1": "^6.24.1",
"babel-register": "^6.26.0",
"bluebird": "^3.5.1",
Expand Down
16 changes: 2 additions & 14 deletions lib/resources/content/babelrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
{
"sourceMap": true,
"sourceRoot": "src",
"moduleIds": false,
"comments": false,
"compact": false,
"code": true,
"presets": [
["es2015", {"loose": true}],
"stage-1"
],
"plugins": [
"syntax-flow",
"transform-decorators-legacy",
"transform-flow-strip-types"
"./.babelrc.js"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,23 @@
module.exports = () => {
return {
"plugins": [
"syntax-flow",
"transform-decorators-legacy",
"transform-class-properties"
"transform-flow-strip-types"
],
"presets": [
[
"env", {
"targets": process.env.BABEL_TARGET === 'node' ? {
"node": process.env.IN_PROTRACTOR ? '6' : 'current'
} : {
"browsers": [
"last 2 versions",
"not ie <= 11"
],
"uglify": process.env.NODE_ENV === 'production',
"browsers": [ "last 2 versions" ]
},
"loose": true,
"modules": process.env.BABEL_TARGET === 'node' ? 'commonjs' : false,
"useBuiltIns": true
"modules": process.env.BABEL_TARGET === 'node' ? 'commonjs' : false
}
]
],
"stage-1"
]
}
}
}
5 changes: 0 additions & 5 deletions lib/resources/content/babelrc.webpack

This file was deleted.

1 change: 0 additions & 1 deletion lib/resources/src/main-webpack.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import environment from './environment';
import {PLATFORM} from 'aurelia-pal';
import 'babel-polyfill';
import * as Bluebird from 'bluebird';

// remove out if you don't want a Promise polyfill (remove also from webpack.config.js)
Expand Down

0 comments on commit 1afe47f

Please sign in to comment.