Skip to content

Commit fe30349

Browse files
authoredNov 1, 2024··
fix: use server.perEnvironmentStartEndDuringDev (#18549)
1 parent 637d31b commit fe30349

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎packages/vite/src/node/server/pluginContainer.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class EnvironmentPluginContainer {
283283
hookName: H,
284284
context: (plugin: Plugin) => ThisType<FunctionPluginHooks[H]>,
285285
args: (plugin: Plugin) => Parameters<FunctionPluginHooks[H]>,
286-
condition?: (plugin: Plugin) => boolean,
286+
condition?: (plugin: Plugin) => boolean | undefined,
287287
): Promise<void> {
288288
const parallelPromises: Promise<unknown>[] = []
289289
for (const plugin of this.getSortedPlugins(hookName)) {
@@ -312,14 +312,16 @@ class EnvironmentPluginContainer {
312312
return
313313
}
314314
this._started = true
315+
const config = this.environment.getTopLevelConfig()
315316
this._buildStartPromise = this.handleHookPromise(
316317
this.hookParallel(
317318
'buildStart',
318319
(plugin) => this._getPluginContext(plugin),
319320
() => [this.options as NormalizedInputOptions],
320321
(plugin) =>
321322
this.environment.name === 'client' ||
322-
plugin.perEnvironmentStartEndDuringDev === true,
323+
config.server.perEnvironmentStartEndDuringDev ||
324+
plugin.perEnvironmentStartEndDuringDev,
323325
),
324326
) as Promise<void>
325327
await this._buildStartPromise
@@ -512,13 +514,15 @@ class EnvironmentPluginContainer {
512514
if (this._closed) return
513515
this._closed = true
514516
await Promise.allSettled(Array.from(this._processesing))
517+
const config = this.environment.getTopLevelConfig()
515518
await this.hookParallel(
516519
'buildEnd',
517520
(plugin) => this._getPluginContext(plugin),
518521
() => [],
519522
(plugin) =>
520523
this.environment.name === 'client' ||
521-
plugin.perEnvironmentStartEndDuringDev !== true,
524+
config.server.perEnvironmentStartEndDuringDev ||
525+
plugin.perEnvironmentStartEndDuringDev,
522526
)
523527
await this.hookParallel(
524528
'closeBundle',

0 commit comments

Comments
 (0)
Please sign in to comment.