THEOplayer / web-ui

UI component library for the THEOplayer Web SDK
https://www.theoplayer.com/docs/open-video-ui/web/
MIT License
10 stars 0 forks source link

Ship ES2015 by default #26

Closed MattiasBuelens closed 1 year ago

MattiasBuelens commented 1 year ago

Currently, we transpile all the way to ES5, to support legacy browsers and older smart TVs. However, this is not without consequences: modern browsers require custom elements to be defined with a true ES2015 class (i.e. class MyElement extends HTMLElement). Otherwise, they'll throw an error:

Uncaught TypeError: Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.

You can work around this by loading custom-elements-es5-adapter.js from the Web Components polyfill (see docs), but this is something users shouldn't need to worry about when they're targeting modern browsers.

Instead, we should ship ES2015 by default, and have customers that need to support older browsers load a separate entry point.