-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
preload does not work and downloaded twice on firefox #1042
Comments
This comment has been minimized.
This comment has been minimized.
are you 100% sure you're not just seeing firefox request stuff from the service worker, and the service worker request stuff from the network? |
This comment has been minimized.
This comment has been minimized.
I am sure. I am not using service worker, though. I've seen
Are there some unspoken rules that I don't know :O? Sorry if that bothers you. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Some discussion of the double download here: https://bugzilla.mozilla.org/show_bug.cgi?id=1425310#c3 I think the line here should detect if it's Chrome vs Firefox/Safari and return
|
Support for 56k of JS while on Chrome I get 40k. |
And you're right @benmccann I see in the compiled client JS code it's inspecting |
Oh wait, this is in the prerendered index.html file, client-side checks like this wouldn't and couldn't be in effect. Anyway this just sounds like a Vite issue, I'll look into their bug tracker. |
I have filed an issue for vite, check vitejs/vite#3133. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
So I tried this on a somewhat more substantial project, something I'm working on at work, and it looks like only the vendor chunk and those two tiny layout and error files are duplicated, everything is single loaded, so it's like a 10kb penalty for Firefox that seems fairly constant as the app grows. I'm not too worried about this issue at the moment anymore. |
i am seeing the same problem with latest FF 89.0.1 if anyone wants to check himself. https://notific.at (might be down, the site is online for testing for now) unfortunately it actually loads every component two times for me. i haven't been able to check it with charles myself, but will do so. update: |
This comment has been minimized.
This comment has been minimized.
Would anyone be able to test this with Vite 2.5 beta? They've added a |
I just tested with |
Not sure if I should open a new issue on this, but I am seeing this issue with Firefox (103.0.2) on latest sveltekit/vite. To reproduce, you can check against https://kit.svelte.dev/ where the issue is visible in devtools/network. Some files are loaded twice and even three times (favicon). This is showing 202kB (Chrome) vs 240kB (Firefox) transferred (with cache disabled) in 36 (Chrome) vs 50 (Firefox) requests. |
Can reproduce on a very simple kit project. Reopening. |
This seems like something that will have to be fixed in Vite. As a test, I removed all the |
Maybe this will help fix the issue? |
As someone that was involved in this Vite issue, I it was fixed in vitejs/vite#9970, which is applied from Please test again and report if the issue continues. |
Thanks for the update! I'll go ahead and close this now since it's been fixed in Vite. 3.2.0 final should be released soon |
Vite 3.2 has been released |
Describe the bug
Here is the firefox bug of module preload: https://bugzilla.mozilla.org/show_bug.cgi?id=1425310, i.e. firefox does not support modulepreload. There is a similar issue for sapper, Replace modulepreload with preload for Firefox and Safari sapper#1387.
The new vite already has a builtin preload plugin https://github.com/vitejs/vite/blob/main/packages/vite/src/node/plugins/importAnalysisBuild.ts#L156-L162 on the client side. It will insert preload links despite sveltejs/kit also does that:
kit/packages/kit/src/runtime/server/page/render.js
Lines 104 to 106 in 1007f67
Links from svelte are like
/./_app/pages/$layout.svelte-3b4aa0d5.js
, but vite checks/_app/pages/$layout.svelte-3b4aa0d5.js
. So vite does not think the inserted link is duplicated. One fix is:<link rel="preload" as="script" crossorigin="" href="/_app/pages/$layout.svelte-a23c4e9e.js">
, but it does not take effect somehow. So when sveltekit import scripts, resource will be downloaded again.To Reproduce
Create an app with layout, build & start, and you should be able to see the twice downloading on the latest firefox.
Expected behavior
Despite of preloading or not, I only want one time downloading.
Information about your SvelteKit Installation:
Diagnostics
-Your browser: firefox 86.0.1
Your adapter: vercel, but I am experimenting with
npm run start
.Severity
I think it can be a major bug, nobody like downloading things twice.
The text was updated successfully, but these errors were encountered: