Skip to content

Commit

Permalink
feat([publish]): migrate to babel-preset-env
Browse files Browse the repository at this point in the history
The change isn't breaking because with default browserlist, it still includes all the transforms
from `es2015-17`
  • Loading branch information
Hypnosphi committed Jan 31, 2018
1 parent 774792e commit 0083e8d
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
[![official JetBrains project](http://jb.gg/badges/official-flat-square.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)

This preset includes all plugins from the [official](https://babeljs.io/docs/plugins/#presets-official-presets) presets
`es2015-17`, `stage-2`, `react`,
`env` (with [`browserlist` defaults](https://github.com/ai/browserslist#queries) as target), `stage-2`, `react`,
and one extra plugin:
[`transform-strict-mode`](http://babeljs.io/docs/plugins/transform-strict-mode). `es2015` is used with `{modules: false}` option, because webpack 2 uses native imports for tree shaking.
[`transform-strict-mode`](http://babeljs.io/docs/plugins/transform-strict-mode). `env` is used with `{modules: false}` option, because webpack 2 uses native imports for tree shaking.

**Note to maintainers**: to trigger publishing of the npm package append *\[Publish\]* to the commit message. For example:

Expand Down
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
module.exports = {
presets: [
require('babel-preset-react'),
[require('babel-preset-es2015').buildPreset, {modules: false}],
require('babel-preset-es2016'),
require('babel-preset-es2017'),
[require('babel-preset-env'), {
targets: {
browsers: 'defaults'
},
modules: false
}],
require('babel-preset-stage-2')
],
plugins: [
Expand Down
59 changes: 57 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
"license": "Apache-2.0",
"dependencies": {
"babel-plugin-transform-strict-mode": "6.24.1",
"babel-preset-es2015": "6.24.1",
"babel-preset-es2016": "6.24.1",
"babel-preset-es2017": "6.24.1",
"babel-preset-env": "1.6.1",
"babel-preset-react": "6.24.1",
"babel-preset-stage-2": "6.24.1"
},
Expand Down

0 comments on commit 0083e8d

Please sign in to comment.