Skip to content

Commit a8f7171

Browse files
authored
Merge pull request #1113 from simon04/issue-796
Clarify output.strictModuleExceptionHandling
2 parents 307a283 + 4e3ede8 commit a8f7171

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

content/configuration/output.md

+23-1
Original file line numberDiff line numberDiff line change
@@ -538,12 +538,34 @@ There is no need to change it.
538538

539539
`boolean`
540540

541-
Tell webpack to remove a module from cache if it throws an exception when it is `require`d.
541+
Tell webpack to remove a module from the module instance cache (`require.cache`) if it throws an exception when it is `require`d.
542542

543543
It defaults to `false` for performance reasons.
544544

545545
When set to `false`, the module is not removed from cache, which results in the exception getting thrown only on the first `require` call (making it incompatible with node.js).
546546

547+
For instance, consider `module.js`:
548+
549+
``` js
550+
throw new Error("error");
551+
```
552+
553+
With `strictModuleExceptionHandling` set to `false`, only the first `require` throws an exception:
554+
555+
``` js
556+
// with strictModuleExceptionHandling = false
557+
require("module") // <- throws
558+
require("module") // <- doesn't throw
559+
```
560+
561+
Instead, with `strictModuleExceptionHandling` set to `true`, all `require`s of this module throw an exception:
562+
563+
``` js
564+
// with strictModuleExceptionHandling = true
565+
require("module") // <- throws
566+
require("module") // <- also throw
567+
```
568+
547569

548570
## `output.umdNamedDefine`
549571

0 commit comments

Comments
 (0)