open-wc / open-wc

Open Web Components: guides, tools and libraries for developing web components.
https://open-wc.org/
MIT License
2.26k stars 422 forks source link

[es-dev-server] Serve not supports Electron container #1754

Open dtanp opened 4 years ago

dtanp commented 4 years ago

Hi Team,

First of all, thanks for great tool. It helps to solve a lot of things!

Unfortunately, we found that es-dev-server doesn't consider Electron container as a modern browser and so it inject polyfills when I serve the page.

Here is the error in the console.

 Using auto compatibility mode, transforming code on older browsers based on user agent.
Resolved to invalid user agent: {"family":"Electron","version":"8.2.4"}. Using max compatibility mode. Try updating your dependencies, or file an issue with a reproduction.

I currently use -c none as a workaround but I wish that es-dev-server can support Electron out-of-the-box.

After a bit of digging in the code, I think it makes sense that UA is resolved as Electron family instead of Chrome family. The browserlist seems to be sensible that it doesn't recognise that Electron is in supporting browser list as technically it's Chrome. I'm not sure what the best solution would be but this may need to handle inside es-dev-server itself..

Here is a basic hello world project and when this project is run inside Electron, it will load polyfill. https://github.com/dtanp/simple-html

LarsDenBakker commented 4 years ago

We're working on a new version of the dev server where this logic is different. We should be able to support this then.