core-js/regenerator-runtime as polyfill options
See original GitHub issueAs 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:
- Created 5 years ago
- Reactions:14
- Comments:9 (3 by maintainers)
Top 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 >
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 Free
Top 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
+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 apolyfillImplementations
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 returnses.promise
where compat expectsPromise
.Indeed, this would be super useful!
Also,
Core-js
as an option. It’s included inside@babel/polyfill
and tellingeslint-plugin-compat
v3 about every polyfill inside of it would require a very long array.