13

I am working on angular app and while run the app it's not showing any errors but I'm getting this kind of warning's in many css files.

Module Warning (from ./node_modules/postcss-loader/src/index.js):
Warning

 (114:1) @import must precede all other statements (besides @charset)

What I have imported on 114 line is this.

@import url(http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css);

Where ever I have imported like this in all that css showing this kind of warnings.

Is there any solution for this?

sohil vaghasiya
  • 533
  • 1
  • 5
  • 13

3 Answers3

20

I want to explain it through two screenshots that why it is giving warning. Because you are not using @import ....line at first line. See this screenshot it is giving warning. enter image description here

see below screenshot this is the solution:

Warning has gone because I have used @import ... line at first line in styles.css file.

enter image description here

Chaman Bharti
  • 408
  • 5
  • 8
3

Your css loader plugin attempts to follow the @import where its not at the top of (first lines of) the css file. @import statements must precede all other statements (besides @charset).

Amirhossein Mehrvarzi
  • 18,024
  • 7
  • 45
  • 70
1

I think this might help It solved it for me by replacing @import "@angular/material/_theming.scss"; with @use "~@angular/material" as mat;

https://stackoverflow.com/a/67850942/16298287