Skip to content

Commit

Permalink
fix: use server.perEnvironmentStartEndDuringDev (#18549)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red authored Nov 1, 2024
1 parent 637d31b commit fe30349
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/vite/src/node/server/pluginContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class EnvironmentPluginContainer {
hookName: H,
context: (plugin: Plugin) => ThisType<FunctionPluginHooks[H]>,
args: (plugin: Plugin) => Parameters<FunctionPluginHooks[H]>,
condition?: (plugin: Plugin) => boolean,
condition?: (plugin: Plugin) => boolean | undefined,
): Promise<void> {
const parallelPromises: Promise<unknown>[] = []
for (const plugin of this.getSortedPlugins(hookName)) {
Expand Down Expand Up @@ -312,14 +312,16 @@ class EnvironmentPluginContainer {
return
}
this._started = true
const config = this.environment.getTopLevelConfig()
this._buildStartPromise = this.handleHookPromise(
this.hookParallel(
'buildStart',
(plugin) => this._getPluginContext(plugin),
() => [this.options as NormalizedInputOptions],
(plugin) =>
this.environment.name === 'client' ||
plugin.perEnvironmentStartEndDuringDev === true,
config.server.perEnvironmentStartEndDuringDev ||
plugin.perEnvironmentStartEndDuringDev,
),
) as Promise<void>
await this._buildStartPromise
Expand Down Expand Up @@ -512,13 +514,15 @@ class EnvironmentPluginContainer {
if (this._closed) return
this._closed = true
await Promise.allSettled(Array.from(this._processesing))
const config = this.environment.getTopLevelConfig()
await this.hookParallel(
'buildEnd',
(plugin) => this._getPluginContext(plugin),
() => [],
(plugin) =>
this.environment.name === 'client' ||
plugin.perEnvironmentStartEndDuringDev !== true,
config.server.perEnvironmentStartEndDuringDev ||
plugin.perEnvironmentStartEndDuringDev,
)
await this.hookParallel(
'closeBundle',
Expand Down

0 comments on commit fe30349

Please sign in to comment.