Skip to content

Commit db50ffb

Browse files
yaaminumontogeek
authored andcommitted
docs(concepts): Add a warning note for common errors when specifying rules (#2376)
* Add a warning note for common errors when specifying rules When specifying a test in `module.rules`, webpack accepts either a regex or string. However it's easy to mistakenly qoute the regex which will cause webpack to not use the specified loader. I added this warning to help newcomers like me who might stumbled into this situation save themselves frustrations and wasted time. * Update index.md * Fix typo: mispelled quote as qoute
1 parent 1349ca6 commit db50ffb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/content/concepts/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ The configuration above has defined a `rules` property for a single module with
119119
120120
W> It is important to remember that when defining rules in your webpack config, you are defining them under `module.rules` and not `rules`. For your benefit, webpack will warn you if this is done incorrectly.
121121

122+
W> Keep in mind that when using regex to match files, you may not quote it. i.e `/\.txt$/` is not the same as `'/\.txt$/'`/ `"/\.txt$/"`. The former instructs webpack to match any file that ends with .txt and the later instructs webpack to match a single file with an absolute path '.txt'; this is likely not your intention.
123+
122124
You can check further customization when including loaders in the [loaders section](/concepts/loaders).
123125

124126

0 commit comments

Comments
 (0)