Skip to content

Load webcomponents polyfill through public folder, not package

I was wrong. custom-elements-es5-adapter is still needed: https://github.com/webcomponents/webcomponentsjs#custom-elements-es5-adapterjs

From Commit Message Description:

Oh boy. The web-components polyfills are not developed, to be used with loading as a js dependency. If you do so, first you will get a build error caused by minfying custom-elements-es5-adapter and after removing it, the next error is caused by webpack not finding vertx dependency.

To fix those errors, there are two ways. One is to run yarn eject and modifying the webpack config, which means you loose the easyiness of create-react-app. Additionaly you have to mess with the webpack config to get it running properly which sucks.

Second option, done here, is to copy the needed polyfills to the public/ folder and include them through ordinary <script> tags. Now we loose the possibilities of dependency management through node, on the other hand I don't have to mess with webpack.

Second reason to use this approach is, as web-components should be implemented in all browser in the future, we can just delete the polyfills.

Edited by Andi Staub

Merge request reports

Loading