I encountered this error
ERROR in ./src/style/MyFont.ttf Module parse failed: /xxx/MyFont.ttf Unexpected character '' (1:0) You may need an appropriate loader to handle this file type. (Source code omitted for this binary file)` when I import my custom font in my less file like this:
@font-face {
font-family: "MyFont";
src: url("./MyFont.ttf") format("truetype");
}
my webpack config is as follow:
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: babelQuery
},{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.less$/i,
use: ExtractTextPlugin.extract([ 'css-loader', 'less-loader' ])
},
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" },
]
Anyone knows how to solve it?