Search code examples
csswebpackcss-loader

what is new URL() syntax in css?


On css-loader changelog, it says since v6 css-loader is generating new URL(...) syntax. I dont quiet understand what the new URL syntax is.

What is the new URL() syntax and how is it different from this url()?


Solution

  • This is nothing to do with the CSS language.

    As part of building your bundle with Webpack, css-loader creates JavaScript code which pulls in your CSS files when it finds some line like import 'my.css' in your JavaScript source.

    What that note is describing is a change in the syntax of the generated JavaScript to create a URL object. It's quite possibly an irrelevant implementation detail from your perspective.