Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2a41584

Browse files
docs(configuration): add example for managedPaths (#6604)
* docs(configuration): add example for managedPaths * update
1 parent 314beb2 commit 2a41584

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

‎src/content/configuration/other-options.mdx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,23 @@ Make sure to wrap the path in a capture group if you use regular expressions.
444444

445445
An array of paths that are managed by a package manager and can be trusted to not be modified otherwise.
446446

447-
Make sure to wrap the path in a capture group if you use regular expressions.
447+
Make sure you wrap the path in a capture group if you are using regular expressions so webpack can extract the path, for example, here's a RegExp webpack internally uses to match the `node_modules` directory:
448+
449+
```text
450+
/^(.+?[\\/]node_modules)[\\/]/
451+
```
452+
453+
A common use case for `managedPaths` would be to exclude some folders from `node_modules`, e.g. you want webpack to know that files in the `node_modules/@azure/msal-browser` folder are expected to change, which can be done with a regular expression like the one below:
454+
455+
```js
456+
module.exports = {
457+
snapshot: {
458+
managedPaths: [
459+
/^(.+?[\\/]node_modules[\\/](?!(@azure[\\/]msal-browser))(@.+?[\\/])?.+?)[\\/]/,
460+
],
461+
},
462+
};
463+
```
448464

449465
### module
450466

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /