-
-
Notifications
You must be signed in to change notification settings - Fork 121
Description
Describe the problem
In Astro we prefer to add <link> tags per component for styles in development mode. This works because Vite will detect a request that has been added via link tag through the Accept header and then injects the direct query param.
For Astro and Vue styles this works because those Vite plugins do not modify the id. Since Svelte creates an id the direct param gets lost.
This means that we cannot use <link> in dev for Svelte, but rather must use a module script which results in a FOUC (flash of unstyled content).
Describe the proposed solution
When generating the cssId, preserve direct query param, if it's included in the importee.
| const cssId = createVirtualImportId(filename, root, 'style'); |
Alternatives considered
No alternatives that I am aware of, other than Astro continuing to use <script> and live with the FOUC.
Note that I am willing to submit a PR for this.
Importance
would make my life easier