WebReflection / babel-plugin-transform-builtin-classes

A fix for the infamous Babel #4480 bug.
https://github.com/babel/babel/issues/4480
ISC License
43 stars 2 forks source link

Understanding when to use what. #9

Closed trusktr closed 7 years ago

trusktr commented 7 years ago

I think I see: I need this transform in case document-register-element isn't loaded, because in that case the transpiled code won't work with native CE v1 even if we had followed the caveat workarounds. Is this right?

It may be helpful for people to have the following details written somewhere:

It's been hard to piece everything together by trial and error over the course of a few days and lots of fiddling, so basically I may have forgotten some details, and you probably know it all best.

trusktr commented 7 years ago

I can try to fill what I think I might know:

WebReflection commented 7 years ago

When should I use document-register-element ?

Whenever you need a customElements polyfill.

When should I use babel-plugin-transform-builtin-classes ?

Whenever you transpile classes that extends native builtins. Native builtins are Array, HTMLElement, String etcetera.


Both projects have nothing to do with each other so when you need custom elements and you need to extend builtin classes, you inevitably need both if you transpile code and your target need a polyfill.