报错信息
根据错误提示信息
You may need an appropriate loader to handle this file type
可以看到,需要适当的加载器对 .ttf 文件和 .woff文件 以及 .woff2文件 进行处理。


解决方法
在 webpack.config.js 中的模块 module 的 规则 rules 添加合适的加载器对 .woff/ttf/woff2等其他文件进行处理从而让浏览器可以解析。
{
test: /\.(ttf|woff|woff2)(\?\S*)?$/,
loader: 'file-loader'
}
再重新运行项目,报错问题就解决了。