@@ -414,12 +414,7 @@ export async function resolveConfig(
414
414
mode = inlineConfig . mode || config . mode || mode
415
415
configEnv . mode = mode
416
416
417
- // Some plugins that aren't intended to work in the bundling of workers (doing post-processing at build time for example).
418
- // And Plugins may also have cached that could be corrupted by being used in these extra rollup calls.
419
- // So we need to separate the worker plugin from the plugin that vite needs to run.
420
- const rawWorkerUserPlugins = (
421
- ( await asyncFlatten ( config . worker ?. plugins || [ ] ) ) as Plugin [ ]
422
- ) . filter ( ( p ) => {
417
+ const filterPlugin = ( p : Plugin ) => {
423
418
if ( ! p ) {
424
419
return false
425
420
} else if ( ! p . apply ) {
@@ -429,22 +424,19 @@ export async function resolveConfig(
429
424
} else {
430
425
return p . apply === command
431
426
}
432
- } )
427
+ }
428
+ // Some plugins that aren't intended to work in the bundling of workers (doing post-processing at build time for example).
429
+ // And Plugins may also have cached that could be corrupted by being used in these extra rollup calls.
430
+ // So we need to separate the worker plugin from the plugin that vite needs to run.
431
+ const rawWorkerUserPlugins = (
432
+ ( await asyncFlatten ( config . worker ?. plugins || [ ] ) ) as Plugin [ ]
433
+ ) . filter ( filterPlugin )
433
434
434
435
// resolve plugins
435
436
const rawUserPlugins = (
436
437
( await asyncFlatten ( config . plugins || [ ] ) ) as Plugin [ ]
437
- ) . filter ( ( p ) => {
438
- if ( ! p ) {
439
- return false
440
- } else if ( ! p . apply ) {
441
- return true
442
- } else if ( typeof p . apply === 'function' ) {
443
- return p . apply ( { ...config , mode } , configEnv )
444
- } else {
445
- return p . apply === command
446
- }
447
- } )
438
+ ) . filter ( filterPlugin )
439
+
448
440
const [ prePlugins , normalPlugins , postPlugins ] =
449
441
sortUserPlugins ( rawUserPlugins )
450
442
0 commit comments