我正在使用由 fontello 制作的自定义图标字体。尝试在 webpack 中使用它时,出现以下错误:
ERROR in ./src/assets/fonts/fontello/fontello.ttf?86736756
Module parse failed:
/Users/idamediafoundry/Documents/Work/Projects/ida-ida-default-
frontend-setup/ida-ida-default-frontend-setup-
static/src/assets/fonts/fontello/fontello.ttf?86736756 Unexpected
character '' (1:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '' (1:0)
它对 woff(2)、ttf、svg ......所有这些都是这样做的。我使用了在 SOF 上找到的几种解决方案,但它们似乎都不起作用。
这是我的 webpack.config.js:
module: {
loaders: [
{ test: /\.js$/, loader: 'babel', exclude: /node_modules/},
{ test: /\.css$/, loader: "style!css!" },
{ test: /\.scss$/, loader: "style!css!sass!" },
{ test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/font-woff'},
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/octet-stream'},
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file'},
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=image/svg+xml'},
]
}
有人对此有任何想法吗?
谢谢!
问候
马里奥