Switch to Webpack asset modules
css-loader 6 deprecates the use of `file-loader`. As a replacement, we can use asset modules which generates very similar results. This is a fairly simple change, and this makes fonts work again. See: https://github.com/webpack-contrib/css-loader/releases/tag/v6.0.0 See: https://webpack.js.org/guides/asset-modules/
This commit is contained in:
@@ -62,18 +62,10 @@ export const config: webpack.Configuration = {
|
||||
},
|
||||
{
|
||||
test: /\.(woff(2)?|ttf|eot)$/,
|
||||
use: [
|
||||
{
|
||||
loader: "file-loader",
|
||||
options: {
|
||||
name: "[name].[ext]",
|
||||
outputPath: "fonts/",
|
||||
// We need this to make Webpack use the correct path for the fonts.
|
||||
// Without this, the CSS file will use `url([object Module])`
|
||||
esModule: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
type: "asset/resource",
|
||||
generator: {
|
||||
filename: "fonts/[hash][ext][query]",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user