Repository navigation
Description
What
Almost every babel-x package right now has a dependency on babel-runtime.
Example with babel-plugin-check-es2015-constants:
| "babel-runtime": "^6.0.0" |
Being able to remove this from all packages would help save time to install (especially npm 2/yarn).
react/create-react-app#1397
Yarn has known issues deduplicating dependencies, sometimes failing to hoist dependencies shared between a ton of packages (such as babel-runtime) and producing installs 5 times bigger than npm: yarnpkg/yarn#2306.
The reason for doing this in the first place has to do with wanting to use built-ins like Symbol/Promise, etc which are not native to node 0.10/0.12. Now that we are on >= Node 4 we should be able to use the native ones.
We don't want to use a polyfill, so we choose to use babel-runtime + babel-plugin-transform-runtime. For more context: http://babeljs.io/docs/plugins/transform-runtime/#why
I think if we don't do this there will be a babel-runtime 7.0 and that won't dedupe correctly etc or we rename to babel-runtime-internal
How to:
- Use node 4 lts
- remove
transform-runtimefrom the babel config - check that tests all pass
- remove
babel-runtimefrom the "dependencies" in each package's package.json and at the top level package.json - EDIT: also need to remove it here: https://github.com/babel/babel/blob/7.0/packages/babel-runtime/scripts/build-dist.js
Wins
- less dependencies, use native, might be faster to run/install
cc @sindresorhus, @insin since I think I recall both of you wanting a solution this even from #3438.
Activity
hzoo commentedon Jan 14, 2017
And I think @kaicataldo said he might be interested
[-][7.0] Possibly remove `babel-runtime` from babel-x packages[/-][+][7.0] Remove `babel-runtime` from babel-x packages (check if we can)[/+]sindresorhus commentedon Jan 16, 2017
Yes please. Babel is always the biggest dependency in my projects because deduping never works and I end up with a gadzillion copies of
babel-runtime.hzoo commentedon Jan 16, 2017
Yep I realized this could probably work since we probably only use node 4 supported ones anyway. Might be hairy but just need to figure it out.
loganfsmyth commentedon Jan 16, 2017
We should make extra sure our tests are running on native Node 4 with no polyfills loaded, otherwise we could run into issues.
hzoo commentedon Jan 16, 2017
This part has to do with
babel-helper-transform-fixture-test-runner/src/index.js:we run tests with
new Functionand also userequire('babel-polyfill')so one solution is to usevm.runInNewContextinsteadchicoxyzzy commentedon Jan 16, 2017
Does someone works on this already?
I think we should mention #5135 in the checklist
hzoo commentedon Jan 16, 2017
^ Can be in 6.x since its internal so not necessary, not sure if anyone working on it, I just asked @kaicataldo if he wanted to look into
I did find we need to remove the
asf extends Map {instore.jschicoxyzzy commentedon Jan 16, 2017
@hzoo there are some other modules in
babel-corewhere we extendStorefromstore.js. I'll try to realise how to refactor all these.hzoo commentedon Jan 16, 2017
Yeah was just talking to Logan about that yesterday haha it's everywhere
kaicataldo commentedon Jan 16, 2017
I'm planning to start looking at this today
chicoxyzzy commentedon Jan 16, 2017
@kaicataldo FYI classes that extend native Map in
babel-corepackage are blocker for this :(https://babeljs.io/docs/usage/caveats/#classes
hzoo commentedon Jan 16, 2017
Yeah we need to make a wrapper instead of extending
mswiecicki commentedon Jan 19, 2017
So what's the status here ? I'd be willing to help with that.
hzoo commentedon Jan 20, 2017
If you'd like to start looking into this, can go ahead. Might need to do it myself if its too involved but we'll see how it goes for you?
Immediately you should see an error
Basically for that we need to not extend a native built-in? Or I guess we could just not compile classes for that specific fix.
mswiecicki commentedon Jan 20, 2017
Ok, so i'll look into that and do my best, but i'll proceed with caution and probably consult a lot.
kaicataldo commentedon Jan 21, 2017
@4rlekin Please feel free to take this on if you're willing. I have some personal things that I have to attend to at the moment and won't be able to get to this until next week at the earliest.
hzoo commentedon Jan 28, 2017
Oops done in #5218!