-
-
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
warning: "@charset" must be the first rule in the file (2.6.x regression ?) #6333
Comments
vite.config.ts
|
Would be great to identify the root cause and fix that. (also, to avoid every vite user adding this workaround) |
Note that esbuild css minification is the one triggering the warnings, and they fixed it in 0.14.6 that only 1 warning is generated (instead of 1 warning per rule before @charset): evanw/esbuild#1862 (But I agree that proper css bundling shouldn't have the @charset rule at all) |
How to ensure proper css bundling? Is there a postcss option that vite could pass to remove |
I'm affected by this, but #6333 (comment) works 👍 |
It should be noted that the |
According to the esbuild warning, it seems like esbuild has a hard stance that that's how I didn't need a postcss plugin to fix it though, but specifying the config for both css: {
preprocessorOptions: {
sass: { charset: false },
scss: { charset: false },
},
}, |
works for me, thanks |
I'm not sure if there's anything else Vite can fix here. esbuild is reporting a real issue IMO, and it's helpful to remove the unwanted |
Agreed. Not closing as as it would be great to identify the root cause and fix that. (also, to avoid every vite user adding this workaround). I'm not knowledgeable enough to identify the root cause. |
The root issue is that some libraries export CSS or SCSS files with the |
Thanks! Looks like libraries are right to have this
Since we can't request libraries to remove the rule, vite should deal with it when building the bundle. The alternative is having every user having to search for this warning, discover & implement the solution. |
Describe the bug
npm run build
shows 100 warnings withAppears to be a regression in 2.6.x
To reproduce:
then add just 3 libraries to package.json and main.js
Minimal repo: https://github.com/mariusa/vite-warn
FYI Also tried adding this to vite.config.js, which is not a solution (hiding the warnings instead of fixing the cause)
but has no effect on warnings.
Previous reports, closed: #5519
Could this be caused by https://github.com/postcss/postcss-import ?
FYI sass/dart-sass#567 (comment)
Reproduction
https://github.com/mariusa/vite-warn
System Info
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: