Skip to content

Commit 0f3b2fa

Browse files
authored
docs: clarify validation flow for plugin options in webpack 5.106
1 parent 3076904 commit 0f3b2fa

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/content/contribute/writing-a-plugin.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export default {
8989
};
9090
```
9191

92-
For webpack versions **before `5.106`**, a familiar pattern is to validate plugin options with [`schema-utils`](https://github.com/webpack/schema-utils) in the constructor:
92+
A familiar way to validate plugin options in webpack versions **before `5.106`** is to use [`schema-utils`](https://github.com/webpack/schema-utils) in the constructor:
9393

9494
```js
9595
import { validate } from "schema-utils";
@@ -116,7 +116,7 @@ export default class HelloWorldPlugin {
116116
}
117117
```
118118

119-
In webpack `5.106` and later, the same plugin can validate those options from `apply()` by tapping `compiler.hooks.validate` and calling `compiler.validate(...)`:
119+
Starting in webpack `5.106`, you can move that validation into `apply()` by tapping `compiler.hooks.validate` and calling `compiler.validate(...)` instead:
120120

121121
```js
122122
export default class HelloWorldPlugin {
@@ -135,7 +135,7 @@ export default class HelloWorldPlugin {
135135
}
136136
```
137137

138-
W> This validation flow is disabled when webpack is configured with `validate: false`.
138+
W> This validation flow is skipped when webpack is configured with `validate: false`. With `experiments.futureDefaults`, validation is enabled by default in development mode and disabled by default in production mode.
139139

140140
## Compiler and Compilation
141141

0 commit comments

Comments
 (0)