Skip to content
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

Implement absoluteImports option #40

Merged
merged 3 commits into from
Nov 9, 2020

Conversation

nicolo-ribaudo
Copy link
Member

This option is similar to @babel/transform-runtime's absoluteRuntime option.
It has been renamed because polyfill providers don't injected imports to @babel/runtime.

PR for @babel/transform-runtime: babel/babel#8435

This option is an improvement over @babel/transform-runtime's, since it also works for polyfills attached to the global scope.

Ref: babel/babel#12035

This option is similar to `@babel/transform-runtime`'s `absoluteRuntime` option.
It has been renamed because polyfill providers don't injected imports to `@babel/runtime`.
@nicolo-ribaudo nicolo-ribaudo added the enhancement New feature or request label Oct 25, 2020
@arcanis
Copy link

arcanis commented Oct 30, 2020

Will this also benefit Babel 7, or only Babel 8+?

@nicolo-ribaudo
Copy link
Member Author

This plugin is already fully compatible with Babel 7: the only difference is that in Babel 8 it will be the only way to inject polyfillls.

We'll discuss if it makes sense to add an equivalent option, or if we'll only implement it here to encourage migration.

@43081j
Copy link

43081j commented Nov 9, 2020

Could you provide an example of how this might be configured?

im guessing like in the migration docs, we wouldn't use preset-env's corejs options anymore but would use this plugin:

  "plugins": [
    ["polyfill-corejs3", {
      "method": "usage-global",
      "absoluteImports": true
      // ..
    }]
  ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants