-
-
Notifications
You must be signed in to change notification settings - Fork 432
Replace modulepreload with preload for Firefox and Safari #1387
Comments
Based on my understanding we should be able to flatten out the dependency graph and include all of them in a set of individual modulepreload directives. The implementation I have locally will emit preload module preload directives based on a boolean. Once I have everything wired up and in production I should be able to provide some real world performance info about what sort of difference different configurations make. |
We do that today, but caniuse says it's only supported in Chrome The line from the article above that I'm concerned about is:
So eventhough we can |
Yeah, I read the article ... Agree it's a good one. I my thinking is that the caveat doesn't apply to sapper though, since the assets are not served in a crossorigin way, and none of the other scripts on the page that would reference the sapper modules. Does this seem incorrect to you? |
With the way that Rollup does code splitting you'll end up with some of the Sapper scripts referencing other scripts. My understanding is that dependencies will be loaded with credentials mode of |
Except doesn't credentials omit only come into play if you're loading modules from other origins? |
From Medium:
|
Ok, after reading that and a bit more spelunking through the spec and corresponding browser issue trackers, it seems like preload-based performance optimizations are not something everyone can take for granted yet. It does seem like parsing of code fetched via preloadmodule is expected to be faster than preload alone, since more of the processing can be handled off the main thread. All things considered, it might make sense to base the decision to move off of esm on real world performance measurements if we can get them. |
Ah, yeah, you're right that |
While reading https://docs.google.com/document/d/1WebH4IOCswACUbaczx5cGQPVl5mnqcieOd4MRJM2syk/edit I saw
Which links to the PR back in 2018 that "fixed" the preload spec for modules: whatwg/html#3656 A comment on that PR suggests that Firefox follows the spec (I think @benmccann found that it's still not on by default):
|
Wow, good find! I guess the Google post that comes up in search results is outdated. I just looked at one of the files that Sapper's loading and it has a So it seems that the |
Is there a precedent for doing browser/user-agent-specific things in SSR yet? |
No, there isn't. I'd try to avoid it as much as possible. But in this case we either have to do that or replace |
The fact that chrome wants to stop sending the User-Agent header doesn't help the situation either :/ Hopefully I'll start having some real world performance data in the near future. |
You'll still be able to tell they're running Chrome and desktop vs mobile though. Just not much else like what OS |
modulepreload
is only supported by 71% of browsers: https://caniuse.com/#search=modulepreloadpreload
is supported by 87% (soon to be > 90% since Firefox beta has support): https://caniuse.com/#search=preloadThere's no way to make
modulepreload
work since our JS files have dependencies on each other: https://developers.google.com/web/updates/2017/12/modulepreloadI'm not aware of a compelling reason to build the
/client/
as ES6 modulesThe text was updated successfully, but these errors were encountered: