-
Notifications
You must be signed in to change notification settings - Fork 12k
warning: "@charset" must be the first rule in the file #22097
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
Comments
A quick fix I found is to put "src/styles.scss" at the beginning of the "styles" array, then you'd get only one warning or so... Otherwise there're hundreds of warnings |
Indeed but this is not a solution for me as I override some css variables in the styles.scss fils so it must be at the end ;-) |
same here:/ |
I confirm the issue .. the problem is there is no way so far to eliminate the warnings by the compiler options. |
…irst rule in the file warning esbuild will issue a warning when `@charset` is in the middle of the file. This is caused by css-loader will concats the file and doesn't hoist `@charset`, (webpack-contrib/css-loader#1212). While, esbuild will issue a warning regarding the above, it will hoist to the very top. In many cases, this warning is not actionable by the users as the `@charset` would be likely specified in 3rd party libs. Closes #22097 (cherry picked from commit b3e5888)
…irst rule in the file warning esbuild will issue a warning when `@charset` is in the middle of the file. This is caused by css-loader will concats the file and doesn't hoist `@charset`, (webpack-contrib/css-loader#1212). While, esbuild will issue a warning regarding the above, it will hoist to the very top. In many cases, this warning is not actionable by the users as the `@charset` would be likely specified in 3rd party libs. Closes #22097
So what is the solution here ? I have the same issue once i migrated to version 13 |
It seems that they implemented a fix so I guess we have to wait for the next version to be released. |
I have the same problem migrating from angular 12 to 13 |
This should not longer be an issue since 13.0.2. Please see https://github.com/angular/angular-cli/releases/tag/13.0.2 for more information about this release. |
It's already fixed on version 13.0.1. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
I'm not sure as the issue didn't occur with ng12 but maybe just because I was building in development mode by default (and the issue only occurs on production mode)
Description
I'm using the "styles" section of the angular.json file to include additional (s)css files:
When trying to build the solution with this, I get a lot of warnings like this:
The weird thing is that this happens whatever the order of the pathes in the array expect when "src/syles.scss" comes first. However, this is not an option for me as I override some styles in this file, so it needs to come last.
Another weird thing is that if I open the corresponding generated styles file, "@charset" only appears as the first rule of the file...
I also tried to duplicate the "styles.scss" file, rename it in "styles2.scss" and add it as the first entry of the styles array (to see if it somehow fixes the issue) but it didn't.
Note there is no "@charset" rule in my "styles.scss", so I really don't understand why the issue does not appear when it comes first in the array.
These are only warnings and the build is valid, however, it creates a lot of noise during the compilation.
Last remark is that it only occurs in production mode, not in development.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in
Anything else?
No response
The text was updated successfully, but these errors were encountered: