Webpack 4: WOFF, WOFF2, SVGs failed to load
Solution 1
You can user webpack url-loader for that and it will resolve your problem.If you are using npm you can install npm install url-loader --save-dev
and in your webpack.config.js you can write module settings like this
{test: /\.(jpg|jpeg|png|woff|woff2|eot|ttf|svg)$/,loader: 'url-loader?limit=100000'}
and import images like import img from './image.svg'
Github : https://github.com/webpack-contrib/url-loader
NPM : https://www.npmjs.com/package/url-loader
Solution 2
{
test: /\.woff(2)?$/,
use: [
{
loader: 'url-loader',
options: {
limit: 10000,
name: './font/[hash].[ext]',
mimetype: 'application/font-woff'
}
}
]
}
It worked for me. And also you can use resolve-url-loader
https://www.npmjs.com/package/resolve-url-loader
Related videos on Youtube

Hemadri Dasari
Founder @ www.letsdoretro.com Checkout Lets do retro Linkedin page. The Next generation collaborative retrospective tool. Where teams discuss what worked and what didn't. Together, online. Please do support by following our page. Checkout my Linkedin Profile
Updated on June 04, 2022Comments
-
Hemadri Dasari 7 months
ERROR in ./node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.woff 1:4 Module parse failed: Unexpected character '' (1:4) You may need an appropriate loader to handle this file type. (Source code omitted for this binary file)
WOFF files are failing to load and I am not getting an idea to why file-loader is failing to load WOFF, WOFF2 and SVG.
Here is my Webpack 4 loaders config:
module: { rules: [ { //tell webpack to use jsx-loader for all *.jsx files test: /\.(js|jsx)$/, exclude: /node_modules/, loader: "babel-loader" }, { test: /\.css$/, loader: "style-loader!css-loader" }, { test: /\.(png|jpg|jpeg|gif|svg|woff|woff2)$/, exclude: /node_modules/, loader: "file-loader" }, { test: /\.(eot|ttf)$/, loader: "file-loader", }, { test: /\.html$/, exclude: /node_modules/, loader: 'html-loader' }, { test: /\.scss$/, loaders: ["style-loader", "css-loader", "sass-loader"] } ] }
Please suggest a solution to me.
-
Hemadri Dasari over 4 yearsThanks for your answer.