Closed michaelfaith closed 1 year ago
The ~
syntax is non standard Webpack syntax and thus it is expected to fail.
Typically libraries provide users with a variable to configure the asset paths.
Example:
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
Command
build
Is this a regression?
The previous version in which this bug was not present was
No response
Description
We use the fontsource project to self-host our fonts, and their sass mixin api creates css that uses a ~ in the url statement for loading the font file. This works fine with the webpack-based builder, as css-loader supports ~ in
url
(https://webpack.js.org/loaders/css-loader/#url). However, when trying the new esbuild builder, I'm getting the following error.Minimal Reproduction
yarn add @fontsource/roboto
styles.scss
:ng build
Exception or Error
Your Environment
Anything else relevant?
I noticed this issue which was closed due to inactivity, reporting the same thing: https://github.com/angular/angular-cli/issues/25089. Someone mentioned it being discouraged by webpack, but I didn't see that anywhere in their documentation. I know the
sass-loader
deprecated the use of it for@use
and@import
, but I didn't see anything aboutcss-loader
deprecating it forurl
. If you think I should bring this to the fontsource team instead, and that using ~ is a bad practice on their part, I'm happy to go that route. But wanted to start here.