Transpiling class based web components with babel

前端 未结 2 462
礼貌的吻别
礼貌的吻别 2021-01-02 01:12

I\'ve a simple web component following the latest web components v1 class syntax, it works great in Chrome and Firefox/Edge (with a polyfill) but I\'d like it to run in IE11

相关标签:
2条回答
  • 2021-01-02 01:44

    To compile Custom Element classes with Babel, you can use this plugin from Github.

    It will use Reflect.construct() instead of new, which is not permitted with HTMLElement objects.

    0 讨论(0)
  • 2021-01-02 01:46

    One solution is to use the native-shim available with this polyfill https://github.com/webcomponents/custom-elements

    It's not perfect though, would like to find a cleaner solution.

    0 讨论(0)
提交回复
热议问题