unjs / fontaine

Automatic font fallback based on font metrics
MIT License
1.47k stars 23 forks source link

Doesn't seem to work with Webpack #291

Open Voltra opened 9 months ago

Voltra commented 9 months ago

🐛 The bug

Added as a regular webpack plugin in my config, when building (with or without the watch flag) the bundle, the font faces and the font-family are all untouched.

🛠️ To reproduce

https://stackblitz.com/edit/webpack-webpack-js-org-7bs3qn?file=webpack.config.js

🌈 Expected behaviour

It should apply the expected transformation per font.

ℹ️ Additional context

The config uses the following loaders for SCSS and CSS:

It also uses stylelint to lint the files.

The postcss config is pretty straight forward as it consists of the default configurations of the following plugins:

Fonts are processed using Webpack 5's asset/module system (instead of file-loader for instance). "Static" fonts that aren't meant to change are not touched by webpack, but referenced in URLs (pointing to the correct file from the main css file's perspective).

NB: I've also tried with file-loader instead, the result is the same