-
-
Notifications
You must be signed in to change notification settings - Fork 881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade Babel to 7.0 #4662
Upgrade Babel to 7.0 #4662
Conversation
01c5d33
to
c138df4
Compare
b245d2a
to
19fe642
Compare
189681a
to
7e0426c
Compare
9251ae2
to
084745f
Compare
bc3996d
to
e41e60e
Compare
7182615
to
388ab58
Compare
151c60f
to
34ca25d
Compare
a454aec
to
049e631
Compare
049e631
to
90b2c00
Compare
90b2c00
to
823f160
Compare
…oader" This reverts commit b1aabb0
…port" This reverts commit 9c1e197
… subclass implementations Babel 7 is more spec compliant, in that it always assigns `undefined` to an own property for each undefined object property; since these methods are meant to be defined on the prototype, this always overrides the implementation with undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally the Babel config was all in one file, but there are enough subtle differences (see review comments) that trying to add exceptions for everything was more complex than duplicating it.
I think that's still the case, so I'm going to revert those changes for now, but we can look into doing it in the future, especially if: ESLint/Ava support import/export syntax (so we can remove the commonjs plugin entirely), and we keep using transform-define
via Webpack for NODE_ENV, so we don't have duplication (in setting "production" and replacing process.env
).
.babelrc
Outdated
"transform-es2015-modules-commonjs", | ||
"transform-flow-strip-types" | ||
], | ||
"sourceMaps": "inline" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inline sourcemaps are required for Ava to give correct line numbers (perhaps not anymore?), but don't work in Webpack. In addition to the settings incompatibility, Webpack handles sourcemaps separately from the source file (e.g.).
babel.config.js
Outdated
'@babel/plugin-proposal-export-namespace-from', | ||
['@babel/plugin-proposal-class-properties', { loose: true }], | ||
['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }], | ||
'@babel/plugin-transform-modules-commonjs', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
babel.config.js
Outdated
|
||
module.exports = { | ||
presets: [ | ||
'@babel/preset-env', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need preset-env, since we only use experimental syntax and already individually include the plugins. I prefer doing it this way so that we have to explicitly opt in to new syntax.
I feel like @preset/env
is more targeted towards webapps that support much older browsers and need to compile a lot more syntax (-> a lot of plugins to add manually), while we just have a few plugins.
package.json
Outdated
@@ -16,11 +16,11 @@ | |||
"scripts": { | |||
"preinstall": "npm -v && node -v && git rev-parse HEAD && git status --porcelain", | |||
"prestart": "rimraf dist", | |||
"start": "webpack --watch --progress --mode development --env.browsers", | |||
"start": "cross-env NODE_ENV=development webpack --watch --progress --mode development --env.browsers", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like using two separate ways of setting "production" (NODE_ENV and --mode)
babel.config.js
Outdated
['@babel/plugin-proposal-object-rest-spread', { loose: true, useBuiltIns: true }], | ||
'@babel/plugin-transform-modules-commonjs', | ||
'@babel/plugin-transform-flow-strip-types', | ||
'transform-node-env-inline', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally I avoided this plugin because it didn't work as well as transform-define (leaving 'production' === 'production'
checks in the code along with dead code). Even if it works now, using two separate ways to replace process.env
properties doesn't seem simpler than the previous solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all your work on this!
Sounds good to me, thanks for the help! |
This shouldn't be merged until Babel 7.0 is actually released.