[✨] use modulepreload if supported #118
Closed
GrandSchtroumpf
started this conversation in
Proposals
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
-
Is your feature request related to a problem?
Using a web worker to
fetch
and 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
modulepreload
provides 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
modulepreload
is 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
,workerFetchInsert
event 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