Closed mattgallagher92 closed 10 months ago
@isaacabraham can you recommend anyone(s) to ask for advice on this?
Any ideas @MangelMaxime ?
I stopped using Webpack in favor of Vite.js since 2 years now.
So I don't have a string opinion on it no, you can try to look at how https://github.com/MangelMaxime/fulma-demo does it. It is still using Webpack 5
Webpack is being replaced by vite in #564. We can close the ticket as soon as that is merged
The new release is out and this shouldn't be an issue anymore.
With the default SAFE Template, importing an npm-installed font via SCSS doesn't work. Errors are shown in the console stating "OTS parsing error: invalid sfntVersion".
Replacing the following line in the
webpack.config.js
withtype: 'asset'
resolved the issue.https://github.com/SAFE-Stack/SAFE-template/blob/fc97e144863b850461d4d6060b84c31b9f5c56fd/Content/default/webpack.config.js#L126
More details about webpack asset modules at https://webpack.js.org/guides/asset-modules/
Repro
You can see a simple repro at https://github.com/mattgallagher92/safe-fonts-bug-repro.
Before installing the font (https://github.com/mattgallagher92/safe-fonts-bug-repro/commit/b8254a7ae5e2612f67bc10b2ea20ea983a856e7e):
After installing the font (https://github.com/mattgallagher92/safe-fonts-bug-repro/commit/14c86f432ed34f1f89d7c670434440ca49628fcb):
After updating webpack config (https://github.com/mattgallagher92/safe-fonts-bug-repro/commit/9037df9354f567ce8ed613a4eb68fb553bcdef26):
Question
Should this change (replacing
use: ['file-loader']
withtype: asset
) be reflected in the SAFE template? Should we be usingtype: asset/resource
instead (at least for font files)? I'm not experienced enough with webpack to be sure of the consequences of this change.