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.

core-js/regenerator-runtime as polyfill options

See original GitHub issue

As raised initially in #103, as a nice solution for minimizing the work needed of eslint-plugin-compat users (and one far easier than some kind of polyfill detection), it would be nice if one could simply indicate use of ~@babel/polyfill~ core-js and regenerator-runtime (maybe within a ‘polyfillImplementations’ settings field if not overloading the polyfills property) and have eslint-plugin-compat be aware that polyfills such as Promise were already covered by those bundles…

One possible challenge might be if new versions of the polyfill changed which polyfills are available, so maybe there should be a version of ~@babel/polyfill~ core-js/regenerator-runtime indicated (defaulting to the latest).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:14
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

11reactions
bjankordcommented, Aug 18, 2019

+1 for this feature. One idea that came to mind around implementing this would be using https://github.com/zloirock/core-js/tree/master/packages/core-js-compat and passing the project’s browserslist config to core-js-compat to generate a listing of all the required core-js modules for a project. This could then be passed on to compat settings under the hood if users specify core-js as a polyfillImplementations in settings. It would likely need a transform between the listing returned from core-js-compat and the config needed for compat. e.g. core-js-compat returns es.promise where compat expects Promise.

7reactions
julienbencommented, Mar 17, 2019

Indeed, this would be super useful!

Also, Core-js as an option. It’s included inside @babel/polyfill and telling eslint-plugin-compat v3 about every polyfill inside of it would require a very long array.

Read more comments on GitHub >

github_iconTop Results From Across the Web

babel/polyfill
Babel includes a polyfill that includes a custom regenerator runtime and core-js. This will emulate a full ES2015+ environment (no < Stage 4...
Read more >
The end of @babel/polyfill: The more efficient alternative?
Replace @babel/polyfill with Webpack and @babel/preset-env instead of directly importing core-js and regenerator-runtime.
Read more >
What's the best practice of babel & core-js? · Issue #905 - GitHub
When I use core-js with babel, I want to try my best to reduce the output file size. So I will configure babel...
Read more >
Babel polyfill is dead. Long live core-js! - Alex Bogovich
@babel/polyfill has been deprecated since babel version of 7.4.0. @babel/polyfill is combination of core-js and regenerator-runtime but it ...
Read more >
Babel 6 regeneratorRuntime is not defined - Stack Overflow
If corejs polyfill is used, you replace @babel/runtime with @babel/runtime-corejs2 (for "corejs": 2 ) or @babel/runtime-corejs3 (for "corejs": 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