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

Revisit polyfilling #62

Open
ZeeCoder opened this issue Dec 5, 2017 · 4 comments
Open

Revisit polyfilling #62

ZeeCoder opened this issue Dec 5, 2017 · 4 comments

Comments

@ZeeCoder
Copy link
Owner

ZeeCoder commented Dec 5, 2017

It might worth reconsidering the polyfilling issue.
Originally I shipped all necessary polyfills to make it easier to adapt the library, but that comes with some cons:

  • Shipping the polyfill adds extra weight to the lib
  • If the polyfill is applied automatically, then that could be applied before the app developer applies its own polyfill => this could result in hard to debug situations, where this lib would polyfill something sooner than the app developer.

Using something like polyfill.io, or just a separate polyfill js file made by the app author should be an easy enough thing to do, since I'm already assuming a lot of knowledge with these modules anyway.

Anyway, needs some more research into polyfilling best practices.

@ZeeCoder
Copy link
Owner Author

ZeeCoder commented Dec 5, 2017

I wonder if it would be possible to ship polyfilled and non-polyfilled versions. 🤔

@ZeeCoder
Copy link
Owner Author

note: Look into babel-preset-env, which is supposedly able to auto-polyfill source code by injecting require statements where needed.
(It still probably doesn't polyfill ResizeObserver though.)

@ZeeCoder
Copy link
Owner Author

ZeeCoder commented Feb 4, 2018

Still no easy solution for this (w3ctag/polyfills#6) but shipping a polyfilled / /non-polyfilled version seems like the best way for now.
(Where polyfills should be included in the lib in a way that does not affect globals.)

@ZeeCoder
Copy link
Owner Author

ZeeCoder commented Feb 4, 2018

UMD support will probably need to be dropped, as automatic polyfilling causes some weird issues with it. (cjs, esm are both fine)
I can polyfill most things automatically, but ResizeObserver will be a harder nut to crack:
babel/babel#7328

@ZeeCoder ZeeCoder added this to the 3.0.0 milestone Feb 5, 2018
@ZeeCoder ZeeCoder removed this from the 3.0.0 milestone Dec 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant