From f902e186b102a45273d6dad4c6affb9da285763a Mon Sep 17 00:00:00 2001 From: Judah Meek Date: Mon, 1 Apr 2024 04:30:52 -0500 Subject: [PATCH] update outdated webpack configuration example (#455) --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 34fe37456..61d7c2e88 100644 --- a/README.md +++ b/README.md @@ -578,8 +578,11 @@ console.log(JSON.stringify(webpackConfig, undefined, 2)) You may want to modify the rules in the default configuration. For instance, if you are using a custom svg loader, you may want to remove `.svg` from the default file loader rules. You can search and filter the default rules like so: ```js -const svgRule = config.module.rules.find(rule => rule.test.test('.svg')); -svgRule.test = svgRule.test.filter(t => !t.test('.svg')) +const fileRule = config.module.rules.find(rule => rule.test.test('.svg')); +// removing svg from asset file rule's test RegExp +fileRule.test = /\.(bmp|gif|jpe?g|png|tiff|ico|avif|webp|eot|otf|ttf|woff|woff2)$/ +// changing the rule type from 'asset/resource' to 'asset'. See https://webpack.js.org/guides/asset-modules/ +fileRule.type = 'asset' ``` ### Babel configuration