This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
[✨] use modulepreload if supported #41
Labels
[STAGE-2] incomplete implementation
Remove this label when implementation is complete
[STAGE-2] not fully covered by tests yet
Remove this label when tests are verified to cover the implementation
[STAGE-2] unresolved discussions left
Remove this label when all critical discussions are resolved on the issue
[STAGE-3] docs changes not added yet
Remove this label when the necessary documentation for the feature / change is added
[STAGE-3] missing 2 reviews for RFC PRs
Remove this label when at least 2 core team members reviewed and approved the RFC implementation
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
The text was updated successfully, but these errors were encountered: