Skip to content

Commit f902e18

Browse files
authored
update outdated webpack configuration example (#455)
1 parent cf90ac5 commit f902e18

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,11 @@ console.log(JSON.stringify(webpackConfig, undefined, 2))
578578
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:
579579

580580
```js
581-
const svgRule = config.module.rules.find(rule => rule.test.test('.svg'));
582-
svgRule.test = svgRule.test.filter(t => !t.test('.svg'))
581+
const fileRule = config.module.rules.find(rule => rule.test.test('.svg'));
582+
// removing svg from asset file rule's test RegExp
583+
fileRule.test = /\.(bmp|gif|jpe?g|png|tiff|ico|avif|webp|eot|otf|ttf|woff|woff2)$/
584+
// changing the rule type from 'asset/resource' to 'asset'. See https://webpack.js.org/guides/asset-modules/
585+
fileRule.type = 'asset'
583586
```
584587

585588
### Babel configuration

0 commit comments

Comments
 (0)