Skip to content

Commit 4932528

Browse files
authored
feat: add perEnvironmentWatchChangeDuringDev (#20996)
1 parent 93e0fe1 commit 4932528

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

guide/api-environment-plugins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ The hook can choose to:
146146
147147
## Per-environment State in Plugins
148148
149-
Given that the same plugin instance is used for different environments, the plugin state needs to be keyed with `this.environment`. This is the same pattern the ecosystem has already been using to keep state about modules using the `ssr` boolean as key to avoid mixing client and ssr modules state. A `Map<Environment, State>` can be used to keep the state for each environment separately. Note that for backward compatibility, `buildStart` and `buildEnd` are only called for the client environment without the `perEnvironmentStartEndDuringDev: true` flag.
149+
Given that the same plugin instance is used for different environments, the plugin state needs to be keyed with `this.environment`. This is the same pattern the ecosystem has already been using to keep state about modules using the `ssr` boolean as key to avoid mixing client and ssr modules state. A `Map<Environment, State>` can be used to keep the state for each environment separately. Note that for backward compatibility, `buildStart` and `buildEnd` are only called for the client environment without the `perEnvironmentStartEndDuringDev: true` flag. Same for `watchChange` and the `perEnvironmentWatchChangeDuringDev: true` flag.
150150
151151
```js
152152
function PerEnvironmentCountTransformedModulesPlugin() {

0 commit comments

Comments
 (0)