-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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: lightningcss fails with html-proxy #13776
Conversation
Run & review this pull request in StackBlitz Codeflow. |
// This happens with html-proxy (#13776) | ||
if (!filePath.endsWith('.css')) { | ||
return src | ||
} |
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.
When running the playground, I got ""
(empty string) as a value of filePath
. I think this doesn't make sense and it's a bug in Lightning CSS. But I think it's fine to merge this as a workaround for now.
We can merge this PR as a temporal patch as suggested, but I think more tests are needed and the way |
Description
Fixes a bug when using Lightning CSS with Vite Server and html-proxy
Additional context
The issue was originally found when attempting to use Storybook with + Vitejs 4.4 with the
lightningcss
optioins enabled.The shell app builds but when build the preview iframe it breaks with the error:
I would guess the problem is here: https://github.com/vitejs/vite/blob/main/packages/vite/src/node/plugins/css.ts#L2176:L2181
When processing CSS from proxy the
filePath
is an empty string or a relative path without a filename so we fail the first condition and try to read the file from the file system.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).