What does the introduction of webpack's css-loader mean?

problem description

css-loader "s npm package Link transfer introduces a sentence that goes like this:

The css-loader interprets @ import and url () like import/require () and will resolve them.
Direct translation of

this sentence: css-loader explains @ import and url () in the same way that import and require introduced.

question

(1) I don"t quite understand this sentence. What do you mean by explaining @ import and url like import/require ()?
(2) seeing some people on the Internet say that the function of css-loader is to make css can be modularized by webpack, then css-loader should not find the statement that introduces css into the js file and parse it?
(3) if nothing but import or require is introduced, how can you interpret @ import and url () "like import/require ()"
(4) "explain @ import and url ()", referring to the resolution of @ import or img/background-image "s url in the css file of import or require?
mainly does not understand the description of this sentence. Although it can be configured, it always cannot understand the principle of css-loader

.
May.09,2022

  1. webpack treats any dependency as a module, and finally organizes it into a huge dependency tree, which should strictly be called a graph;
  2. usually when you introduce other resources into js, you use import/require and think it should be so, but do you realize that this is only part of the js syntax, but at the tool level, it is interpreted as referring to another resource
  3. but what do I need to do when I need to reference resources in css? if you also use import/require , is there this syntax in css? then think about the syntax for introducing resources into css. Of course, you can define the so-called import/require , but others may be blurred
  4. .
  5. to put it bluntly, in order to maintain dependency, it doesn't matter how you use it, but it should be compatible with existing things
  6. .
Menu