-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add babel7 config #1103
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
Add babel7 config #1103
Conversation
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.
This is solid, I love the line deletions with it! I left some comments with some questions. I'm mostly curious how this will affect the bundle size and speed(!) compared to babel 6. I remember doing some dark magic with polyfills in https://github.com/CompuIves/codesandbox-client/blob/master/packages/common/load-dynamic-polyfills.js. Might be interesting to look at.
Very nice! Let's merge this in soon 😄.
@@ -55,6 +55,7 @@ module.exports = { | |||
entry: SANDBOX_ONLY | |||
? { | |||
sandbox: [ | |||
'@babel/polyfill', |
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'm wondering if this would make the bundler bigger than it needs to be, since with this it's including all babel polyfills out there. Is there a way to make this more fine-grained? I thought that babel-preset-env would do something like this.
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.
Yeah, I think we only need a setImmediate poly... which can basically just be:
global.setImmediate = global.setImmediate || global.requestAnimationFrame
Will try to remove that and only use custom stuff inside existing polyfill file there
return <LoadedComponent />; | ||
} | ||
|
||
return <Loading />; |
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.
Can we show the spinner after a set time, like 1s? That will make perceived loading speed faster and is what Loadable has been doing.
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.
Jup, for sure, let me fix :)
packages/app/config/babel.prod.js
Outdated
@@ -4,33 +4,32 @@ module.exports = { | |||
// Don't try to find .babelrc because we want to force this configuration. | |||
babelrc: false, | |||
presets: [ | |||
require.resolve('@babel/preset-flow'), | |||
// Latest stable ECMAScript features | |||
[ | |||
'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.
It seems like this 'env' has been unchanged, but that should work too, right?
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.
Ah, let me fix that, just to be certain it uses the new stuff
@@ -4,33 +4,32 @@ module.exports = { | |||
// Don't try to find .babelrc because we want to force this configuration. | |||
babelrc: false, | |||
presets: [ | |||
require.resolve('@babel/preset-flow'), | |||
// Latest stable ECMAScript features | |||
[ | |||
'env', | |||
{ | |||
targets: { | |||
ie: 11, |
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'm thinking that we should replace this target with something sensible for CodeSandbox, like 99%>. I will check the analytics.
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.
Great, do that :)
Okay, so I had to do some additional work here. Mostly fixing testing. With Babel 7 there are some adjustments to how Jest finds and handles test files.
It really is insane how difficult it is to maintain these large projects, but I think this move it very important. When you get the "insides" on babel 7 as well there is a lot of cleanup that can be done! Hopefully the last fix is moving in now. Just add the babel 7 bridge thingy as a dep, while it was also a devDep :) |
Not sure what happens on the integration tests there? Any way to run that locally? Or maybe it is related to PR deployment error there? Maybe I broke some production config. Could you help me find some error message? :) |
7b92de1
to
4bac6c4
Compare
3482eb3
to
f2a2e78
Compare
No description provided.