-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
Incorrect warning/error when @layer is used before @import #17424
Comments
Start a new pull request in StackBlitz Codeflow. |
I'm not getting the same error with the repro:
I get this warning, and the wording is slightly different from what you're showing. Is there some other configuration that causes it? |
@bluwy Not sure why the wording is different and its just a warning and not an error, but it seems like its the one. |
Here's the full error when I run
|
@bluwy Did above help? |
Not much unfortunately. I don't know the code that could have trigger the error instead of a warning for me. It's hard to debug from there on. |
@bluwy The warning is also incorrect. I'm assuming it could be something on my config that is considering that same warning as an error but it looks like its from the same issue where the [vite:css]'s logic considers using Here's my config for reference:
|
@bluwy I tried to see if I can find where the error handling was but seems like vite:css is not pubic and I can't check them out. Let me know if there's anything else I can provide to fix the incorrect warning/error. |
bump! |
By adding These warning/error messages are incorrect (postcss/postcss-import#566, parcel-bundler/lightningcss#803), but your CSS code is incorrect as well. The spec disallows having I'm not familiar with CSS layers but probably the following CSS would achieve what you want to do. @import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+KR:wght@100;200;300;400;500;600;700&display=swap') layer(font);
@import url(./tester.css) layer(base);
@layer font, reset, base, variant, state, component; Closing as this is not a bug in Vite. |
I needed the
Fyi, I was able to reproduce the warning without having css.transformer being set to lightningcss, I'm not sure why it didn't reproduce for you. Might be another issue. Also, I think the warning message is helpful in finding out how to fix the issue. I would suggest making the message clearer or even just adding the spec link would have helped me resolve. |
Describe the bug
I'm using
@layer
on my .css file but to have enforce the order of layer properly, the layers have to be defined before its use. When I put@layer
order defined above@import
, I'm getting the follow error which indicates that it should work but still gives the error.It says
aside from @charset and @layer statement
which is my case but error keeps showing up. You can check out the reproduction for more testing.Reproduction
https://stackblitz.com/edit/vitejs-vite-osezjn?file=style.css
Steps to reproduce
Run
npm install
andnpm run dev
System Info
Not sure why but above code to output did not work for me
Used Package Manager
pnpm
Logs
Click to expand!
Validations
The text was updated successfully, but these errors were encountered: