I solved the problem by creating a new rule inside bud.config.js that uses webpack 5 Asset Modules:
/**
* Fonts
*/
app.hooks.on('build.module.rules.oneOf', (rules = []) => {
rules.push({
test: /node_modules\/(.*)\.(woff|woff2|eot|ttf|otf)$/,
type: 'asset/resource',
generator: {
filename: 'fonts/[name].[contenthash:6][ext]',
},
});
return rules;
});
It matches font files (woff, woff2, eot, ttf, otf) and copies them to [public path]/fonts directory.
If anyone has another solution or a better idea, please let me know