Skip to content

Commit

Permalink
feat(plugin-api): parallel execution of async configResolved
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikg committed Apr 12, 2021
1 parent 3196616 commit fac226c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/guide/api-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Vite plugins can also provide hooks that serve Vite-specific purposes. These hoo
### `configResolved`

- **Type:** `(config: ResolvedConfig) => void | Promise<void>`
- **Kind:** `async`, `sequential`
- **Kind:** `async`, `parallel`

Called after the Vite config is resolved. Use this hook to read and store the final resolved config. It is also useful when the plugin needs to do something different based the command is being run.

Expand Down
8 changes: 3 additions & 5 deletions packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,9 @@ export async function resolveConfig(
)

// call configResolved hooks
for (const p of userPlugins) {
if (p.configResolved) {
await p.configResolved(resolved)
}
}
await Promise.all(
userPlugins.map((p) => p.configResolved && p.configResolved(resolved))
)

if (process.env.DEBUG) {
debug(`using resolved config: %O`, {
Expand Down

0 comments on commit fac226c

Please sign in to comment.