Skip to content

Commit

Permalink
update outdated webpack configuration example (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
Judahmeek authored Apr 1, 2024
1 parent cf90ac5 commit f902e18
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f902e18

Please sign in to comment.