Replies: 1 comment 3 replies
-
I think this is similar to #16587 and is something @ArnaudBarre has been experimenting with. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently Vite uses etags to cache user js modules, for node_modules instead it sets an immutable cache-control header.
Using etags adds latency because the browser has to make a roundtrip to the dev server to check if the module was updated.
In theory it's possible to set the cache-control header to immutable if you pass the module hash in the import query string:
This way the entrypoint will import cached modules if they didn't change and get the response from the dev server if the module changed.
If the user reloads the page and all the modules are unchanged the browser will only fetch the entrypoint.
This will help with large codebases with lots of modules, it removes the overhead of doing many roundtrips to the server, which are also limited by the browser requests concurrency (which is 6 to my knowledge)
Did you already think about implementing this feature? Are there any blockers?
Beta Was this translation helpful? Give feedback.
All reactions