-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(dev): only inject css link tags that have js importers #7267
base: main
Are you sure you want to change the base?
Conversation
|
commit: |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert this file :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it just adds it back every build
const allModules = Array.from(server.moduleGraph.fileToModulesMap.entries()); | ||
|
||
const CSS_EXTENSIONS = ['.css', '.scss', '.sass', '.less', '.styl', '.stylus']; | ||
const JS_EXTENSIONS = ['.js', '.ts', '.tsx', '.jsx']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/.([mc]?[tj]sx?$/.test(ext)/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is also .mjs and everything with m
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also we need to escape the .
/\.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both added as regexes now
const added = new Set(); | ||
const allModules = Array.from(server.moduleGraph.fileToModulesMap.entries()); | ||
|
||
const CSS_EXTENSIONS = ['.css', '.scss', '.sass', '.less', '.styl', '.stylus']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should let the dev add or configure this just in-case the extensions change. but these are good defaults of course
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd need to modify the vite plugin API to do that. In which case we already plan to move the dev server to Qwik Router, so we should wait in this case before any API changes.
@@ -3653,7 +3653,7 @@ Options for the prefetch service worker. | |||
</tbody></table> | |||
**Returns:** | |||
[JSXNode](#jsxnode)<'script'> | |||
JSXNode<'script'> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run pnpm api.update
. Unfortunately the build messes with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please undo
@@ -192,26 +199,11 @@ export async function configureDevServer( | |||
|
|||
const result = await render(renderOpts); | |||
|
|||
// Sometimes new CSS files are added after the initial render | |||
Array.from(server.moduleGraph.fileToModulesMap.entries()).forEach((entry) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't you now ignoring newly added css modules?
I think it would be better to generate the current list of css files on every update and make sure only those are injected?
Builds on top of #7266, otherwise I can't build Qwik.
Fixes #5965 in the Qwik vite dev server.