question: it is not clear why @babel/runtime is included in the deps of 10-alpha
See original GitHub issueTwo years ago in #397 babel-runtime has been removed by @zerkalica with a reason to reduce end user bundle size, but in august last year in #833 @babel/runtime
has been re-added by @TrySound with a readded with the same reasoning of reducing end user bundle size.
I dont understand re-addition of it and I dont claim it is wrong. I perhaps need more details behind this reasoning and how that was meant to work.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (8 by maintainers)
Top Results From Across the Web
Do @babel/runtime / @babel/plugin-transform-runtime in CLI ...
The short answer is yes: @babel/runtime (and @babel/plugin-transform-runtime ) is intended to be treated as a dependency.
Read more >babel/runtime
babel /runtime` is a library that contains Babel modular runtime helpers. ... This is meant to be used as a runtime dependency along...
Read more >@babel/runtime | Yarn - Package Manager
Intro. Babel is a tool that helps you write code in the latest version of JavaScript. When your supported environments don't support certain...
Read more >Cannot find module 'babel-runtime/helpers/asyncToGenerator'
I am using Debian's provided yarn, and nvm for node.
Read more >How I solved and debugged my Webpack issue through trial ...
js ) and one of the source files contains an error, the stack trace will simply point to bundle.js . This isn't always...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To be fair, I think the reasons provided in #397 were unreasonable in the sense there must have been some issue with tree shaking. The author of the issue claimed that the full 34kb of core-js were imported into his bundle, but in that example only a few helpers / core-js functions were required. With proper tree-shaking applied, the size-penalty would have been much less than that.
After all, the imports from babel-runtime should not be any different than the one babel inlines into the source files (except for loose mode, obviously). This implies that there should, with proper tree shaking, never be a negative (with negative meaning a bigger bundle) difference when extracting helpers into
babel-runtime
.I’m very much in favor of extracting the helpers to reduce duplication.
@iamstarkov We do not add any polyfills. Current babel runtime allows to share helpers like _extends, _inheris, _createClass between many packages so they are not duplicated dozens of times in user bundle. These helpers also cherry-picked like
@babel/runtime/esm/helpers/extends
which prevents appearing unnecessary code in user bundles.