Skip to content

Commit

Permalink
refactor: better types
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Jun 14, 2022
1 parent ba89b19 commit 59b57e9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions packages/vite/src/node/config.ts
Expand Up @@ -337,19 +337,19 @@ export async function resolveConfig(
configEnv.mode = mode

// resolve plugins
const rawUserPlugins = (await asyncFlatten(config.plugins || [])).filter(
(p: any) => {
if (!p) {
return false
} else if (!p.apply) {
return true
} else if (typeof p.apply === 'function') {
return p.apply({ ...config, mode }, configEnv)
} else {
return p.apply === command
}
const rawUserPlugins = (
(await asyncFlatten(config.plugins || [])) as Plugin[]
).filter((p) => {
if (!p) {
return false
} else if (!p.apply) {
return true
} else if (typeof p.apply === 'function') {
return p.apply({ ...config, mode }, configEnv)
} else {
return p.apply === command
}
) as Plugin[]
})
const [prePlugins, normalPlugins, postPlugins] =
sortUserPlugins(rawUserPlugins)

Expand Down

0 comments on commit 59b57e9

Please sign in to comment.