[✨] use modulepreload if supported #118
Closed
GrandSchtroumpf
started this conversation in
Proposals For Qwik
Replies: 2 comments
-
|
We moved this issue to |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
closed in favor of #182 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem?
Using a web worker to
fetchand cache modules requires an additional network and only cache the request (not parsed nor compiled)Describe the solution you'd like
MDN: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/modulepreload
modulepreloadprovides a way to fetch, cache, parse, compile the module and its script graph it ahead of time.The documentation mentions that the main reason not to use
modulepreloadis that support is not good, so we need backward compatibilty.In the server: Qwik add
<link rel="modulepreload" href="..." as="script" />for every module required for the page.<link rel="modulepreload" href="..." as="serviceworker" />for the main serviceworker.In the client: 2 options
workerFetchInsert,workerFetchInsertevent and if modulepreload has already worked, then file would already be in the cache anywayHere is a way to verify if browser supports modulepreload :
Describe alternatives you've considered
Keep using fetch() in web worker but we miss the parse & compile operation
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions