Skip to content

Commit ad832f6

Browse files
add disclaimer to include node_modules to babel ignore option
1 parent d936f01 commit ad832f6

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
@@ -179,20 +179,23 @@ as `[path]` in `filename` pattern.
179179
Make sure you set `ignore` option of `babel-register` to ignore all files used by css-modules-require-hook to process your css files.
180180

181181
**Require `babel-register` only once otherwise it will fail**
182+
**Be aware, you need to explicitly ignore `node_modules` if you set `ignore` option**
182183

183184
```js
184185
require('babel-register')({
185-
ignore: /processCss\.js$/ // regex matching all files used by css-modules-require-hook to process your css files
186+
ignore: /(processCss\.js|node_modules)/ // regex matching all files used by css-modules-require-hook to process your css files
186187
})
187188
```
188189

189190
## Using in mocha
190191

191192
Create a js file with content
192193

194+
**Be aware, you need to explicitly ignore `node_modules` if you set `ignore` option**
195+
193196
```js
194197
require('babel-register')({
195-
ignore: /processCss\.js$/ // regex matching all files used by css-modules-require-hook to process your css files
198+
ignore: /(processCss\.js|node_modules)/ // regex matching all files used by css-modules-require-hook to process your css files
196199
})
197200
```
198201

0 commit comments

Comments
 (0)