fix(vite): dev ssr fouc with preprocessors #916
Conversation
✔️ Deploy Preview for nuxt3-docs ready! 🔨 Explore the source changes: 370d83f 🔍 Inspect the deploy log: https://app.netlify.com/sites/nuxt3-docs/deploys/6166a917307008000815aaed 😎 Browse the preview: https://deploy-preview-916--nuxt3-docs.netlify.app |
@@ -16,7 +16,24 @@ export function uniq<T> (arr: T[]): T[] { | |||
} | |||
|
|||
const IS_CSS_RE = /\.css(\?[^.]+)?$/ | |||
const IS_DEV_CSS_RE = /\.(?:css|scss|sass|postcss|less|stylus|styl)(\?[^.]+)?$/ |
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.
What about IS_SRC_CSS_RE
or IS_UNPROCESSED_CSS_RE
? dev is misleading imo little bit
return file | ||
} | ||
if (file.includes('?')) { | ||
return file + '&' + MOCK_CSS_SUFFIX |
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.
Can we use withQuery
from ufo? It should handle this cases
enforce: 'pre', | ||
configureServer (server) { | ||
server.middlewares.use((req, _, next) => { | ||
if (req.url.endsWith(MOCK_CSS_SUFFIX)) { |
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.
Can't we use resolveId
hook to fix issue?
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.
Alternatively, what about updating regex in vue-bundle-renderer. Would it fix without workaround?
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.
Ah, I didn't know we have control of that package. That would defintely better to be fixed there.
Close in favor of nuxt-contrib/vue-bundle-renderer#18 |
close nuxt/nuxt#11990
We append
&__nuxt_mock.css
for preprocessors extensions in the manifest for the renderer to treat it as css and rewrite back on serving.