Skip to content

Clarify output.strictModuleExceptionHandling #1113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion content/configuration/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -531,12 +531,34 @@ There is no need to change it.

`boolean`

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

It defaults to `false` for performance reasons.

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).

For instance, consider `module.js`:

``` js
throw new Error("error");
```

With `strictModuleExceptionHandling` set to `false`, only the first `require` throws an exception:

``` js
// with strictModuleExceptionHandling = false
require("module") // <- throws
require("module") // <- doesn't throw
```

Instead, with `strictModuleExceptionHandling` set to `true`, all `require`s of this module throw an exception:

``` js
// with strictModuleExceptionHandling = true
require("module") // <- throws
require("module") // <- also throw
```


## `output.umdNamedDefine`

Expand Down