Giter Club home page Giter Club logo

Comments (7)

zloirock avatar zloirock commented on May 14, 2024 1

Just direct import of polyfills, I don't see any other way. I don't know anyone package which can provide required polyfills in the required format (ES or commonjs modules for each feature).

I'm thinking about adding polyfills for a serious part of web standards to core-js in the future since now we have tools like preset-env and runtime. However, if it will be done - it will be done not soon.

from babel-polyfills.

babel-bot avatar babel-bot commented on May 14, 2024

Hey @nitwhiz! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community
that typically always has someone willing to help. You can sign-up here
for an invite.

from babel-polyfills.

zloirock avatar zloirock commented on May 14, 2024

Just interesting, how you are imagining it? polyfill-library does not support ES or commonjs modules, just files concatenation. It was a reason why some time ago core-js was not added to polyfill-service / polyfill-library as a polyfills source.

from babel-polyfills.

nitwhiz avatar nitwhiz commented on May 14, 2024

polyfill-library has all the meta information for their polyfills. like detection for when to apply them and everything. just in a different format. I suggest the black magic @babel/babel-polyfill is using to detect that I used a Promise and @babel/preset-env is set to "IE >= 11", so it needs to polyfill Promise would work for stuff like ChildNode.remove or fetch. Retrieving the actual polyfill wouldn't be much different.

from babel-polyfills.

zloirock avatar zloirock commented on May 14, 2024

polyfill-library has all the meta information for their polyfills. like detection for when to apply them and everything. just in a different format.

That's perfect and really useful. But @babel/preset-env with useBuiltIns: usage / entries just add imports of required polyfills as commonjs modules. It can't work with polyfill-library.

from babel-polyfills.

nitwhiz avatar nitwhiz commented on May 14, 2024

So what's the supposed way to include custom polyfills? The main thing I'm after is the useBuiltIns:usage feature so I don't need to worry about polyfills and they get done from alone. How to accomplish this with other polyfills. Can I provide more polyfills in the format core-js is using and make @babel/preset-env use them? If yes - how?

The main goal is to keep my head free from thinking about "does this work?" "do i need to check if XMLHttpRequest exists?" - it would be nice to just write ES6 code with standards the majority (aka chrome) of browsers accept and having stuff that won't work on browsers in my browserlist transpiled to something that works from alone.

from babel-polyfills.

nitwhiz avatar nitwhiz commented on May 14, 2024

Nah I mean like providing them in the correct format. I would like to provide the polyfills I need in the correct format myself so babel will pick them up.

from babel-polyfills.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.