question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot set core-js version for helper-only transformation in `@babel/tranform-runtime`

See original GitHub issue

Feature Request

Is your feature request related to a problem? Please describe.

Basically we are trying to resolve this issue in @vue/babel-preset-app:

https://github.com/babel/babel/issues/6628 How can we write ES20xx and ship the smallest amount of code (for a given target environment)?

To be more specific, this item:

  • To achieve that we need to combine @babel/preset-env with @babel/transform-runtime, and the latter one is only used to do helper transformation.
  • The default runtime has a blocking issue though, see https://github.com/babel/babel/issues/7597
  • So to circumvent it we have to use @babel/runtime-corejs2. I know it’s not the best solution but it’s an acceptable compromise/tradeoff in practice.
  • Before beta.56 we were able to disable polyfills option while still referring the helper functions to @babel/runtime-corejs2.
  • But after this commit, polyfills option is removed because it is now the default behavior.
  • An unintended consequence is that we can no longer point helpers to any other runtime package without introducing core-js polyfills along with it.

Describe the solution you’d like

Bring back the polyfills option, allowing the user to opt-out it while still being able to specify a core-js version for helpers.

Describe alternatives you’ve considered N/A

Teachability, Documentation, Adoption, Migration Strategy N/A

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nicolo-ribaudocommented, Apr 26, 2019

As a workaround, you can use https://github.com/tleunen/babel-plugin-module-resolver to alias @babel/runtime -> @babel/runtime-corejs2

0reactions
nicolo-ribaudocommented, Mar 13, 2020

I’m closing this issue, since it’s possible to transpile @babel/runtime with @babel/preset-env to add polyfills.

Read more comments on GitHub >

github_iconTop Results From Across the Web

babel/plugin-transform-runtime
A plugin that enables the re-use of Babel's injected helper code to save on codesize.
Read more >
babel 7.x - Can't resolve 'core-js/modules/es.array.concat'
To resolve this error, you can downgrade the core-js version to 2.5.7. This version produces correct catalogs structure, with separate ES6 ...
Read more >
core-js
Standard library. Latest version: 3.26.1, last published: a month ago. Start using core-js in your project by running `npm i core-js`.
Read more >
How babel preset-env, core-js, and browserslistrc work ...
@babel/preset-env is a collection of babel plugins to transform modern ... We're targeting a new Firefox version in .browserslistrc , so you ...
Read more >
Babel polyfill is dead. Long live core-js! - Alex Bogovich
Lets see how to set core-js version and combine it with babel without ... to core-js@2 and cannot provide smooth migration to core-js@3....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found