Skip to content
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(hmr): don't try to rewrite imports for direct CSS soft invalidation #18252

Conversation

sapphi-red
Copy link
Member

Description

When a direct CSS is soft invalidated and has a content that fails to parse by es-module-lexer (this only happens some times as ex-module-lexer is quite relax with invalid syntaxes), Vite failed to load that file after a refresh.

A direct CSS file is soft invalidated when the file depends on a JS file. This happens if a file included in tailwind's content option is updated. For example, the reproduction in the issue has assets/custom.css and is imported by app.vue and that is included by tailwind's content option.

fixes nuxt/nuxt#26454

@sapphi-red sapphi-red added feat: css feat: hmr p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority) labels Oct 2, 2024
Copy link

stackblitz bot commented Oct 2, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@sapphi-red sapphi-red force-pushed the fix/dont-try-to-rewrite-imports-for-direct-css-softinvalidation branch from b6d969e to cb40cb5 Compare October 2, 2024 01:38
@bluwy bluwy merged commit a03bb0e into vitejs:main Oct 4, 2024
12 checks passed
@sapphi-red sapphi-red deleted the fix/dont-try-to-rewrite-imports-for-direct-css-softinvalidation branch October 4, 2024 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: css feat: hmr p3-downstream-blocker Blocking the downstream ecosystem to work properly (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CSS HMR errors from Tailwind arbitrary value classes
2 participants