-
-
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
currentcolor + oklch() values inside a selector triggers error when Vite builds with LightningCSS #17900
Comments
Start a new pull request in StackBlitz Codeflow. |
This may be a gray area, but it's probably working as intended since Other than this, I think there is still an issue on lightningcss side. The error happens when Vite uses default targets from vite/packages/vite/src/node/plugins/css.ts Lines 180 to 182 in 83355a6
vite/packages/vite/src/node/constants.ts Lines 21 to 27 in 83355a6
and this can be reproduced on their playground with |
@mrredtree I agree |
Describe the bug
Previously, an issue was reported in Vite and in LightningCSS repositories about: LightningCSS not recognizing a combination of oklch and currentColor inside a selector.
That issue has been solved by LightningCSS and released in version 1.25.
Tip
Observe that issue in LightningCSS Playground. Select version <=1.24 in the sidebar (to see the Error message), and select version >=1.25 in the sidebar (to see No Error message anymore).
Since Vite 5.2.12, LightningCSS has been updated to version 1.25.
We expected that issue to be solved, however today it still happens in Vite.
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-k4wy6a
Steps to reproduce
Run
npm run vite:build
.You should see this error in the console:
There are 2 scenarios in which this error does not happen. Observe them below:
Scenario 1 - comment the problematic selector
Comment the selector
.baby-currentcolor-and-oklch
insrc/babies.css
file:Run
npm run vite:build
You should not see the error anymore in the console.
Scenario 2 - write
css.ligtningcss.target
in Vite configIn the
vite.config.js
file, uncomment the line 20, from this:to this:
Run
npm run vite:build
You should not see the error anymore in the console.
Note
It should not have been necessary to write
css.lightningcss.targets
, becausebuild.cssTarget
was already set in Vite config!This is another bug. It was already reported in Vite repository. The cause of this another bug apparently is: LightningCSS expects an array of strings instead of string, and each string should be written in the format provided by Browserslist instead of 'es2022'.
System Info
Logs
Click to expand
The text was updated successfully, but these errors were encountered: