I ran into a well known problem that, however, has no clear solution: the following setup of webpack (encore, within Symfony) produces the error downloadable font: rejected by sanitizer ...
in Firefox and failed to decode downloaded font
in Edge for some (not all!) @fontawesome fonts and IPM Plex Mono (which I installed via npm)
.addLoader(
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: 'file-loader',
options: {
name: "[name].[ext]",
outputPath: "./fonts"
}
}
]
})
I already tried everything that I could find on stackoverflow, github, and other sites. Not another loader (url-loader), a modification of the outputPath or setting the publicPath, nor anything else helped. The error remains the same. The imports are all fine since there is no compilation error by webpack. Without this part of the webpack config, everything is fine too. The webserver is submitting the file correctly and accessing the URL for it directly downloads a valid font file. Thus the path and anything else seem to be ok. So...what's wrong here?
The problems occure in Firefox, Chrome and Edge (latest version each).
Any idea how to fix this?