-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ES modules and dynamic import for Webpack latest builds #16620
Conversation
Way too late here to fix the mocha issue... 😢 |
Test failure is another |
Crickets at |
It seems like our background workers no longer work (like the datatable filtering and sorting https://github.com/home-assistant/frontend/blob/dev/src/components/data-table/sort-filter.ts) after this PR. Will check tomorrow if I can find the issue, otherwise I will have to revert this for the beta. |
Hmmm... are you seeing errors? They should be loaded using |
No errors... :-( |
Doesn't resolve |
I'm just gonna revert this for now, if we fix it we can add it all back in :-) |
Yeah that's defaulting it to The service worker was okay right? That part I did test and it seemed to be caching fine. |
So similar to entry chunks, it doesn't look like the worker chunks are fully converted to ESM yet, which means its exports probably don't work. I'll see if they can just be loaded the old way without breaking the rest. |
Scratch that... |
Okay after researching this a bit, it seems we actually have 2 problems regarding ESM workers:
So we either find the Thoughts? |
Given that Firefox won’t support it for a while, I suggest we keep workers with 0 imports. That way comlink will also continue to work right? |
If we implement something like #16506, then the Firefox restriction isn't too long a wait. Presuming it works well in 114 (release this Tuesday), ESR will then switch to 115 and drop 102 completely after a few months (Firefox release schedule). I'm still trying to prove |
I do not want to kick out all current Firefox versions from latest. So we should wait then until ESR has been released. |
No that won't happen. Working around the webpack/comlink issue will moot the Firefox issue. |
|
Proposed change
Output ESM for chunks instead of classic scripts, and have Webpack load them with
import()
instead ofscript
elements. Technically, this is still "experimental" in Webpack, but it's been implemented for quite some time, seems pretty stable in the release notes, and this change is overdue I think. A few details:browserslist
environments to set the runtime code features, which required removing KaiOS, UC, and QQ from the list (ref: Usesupports X
Browserslist query instead of exact versions list webpack/webpack#14226)I did try to compare page load time for the demo content and this change was pretty much always faster, maybe by about 1.5-2x (with large variability obviously).
As a sign of stability, the bundle is more or less identical aside from the format change and considerably less injected runtime code:
Type of change
Example configuration
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: