Skip to content

Commit 9babef5

Browse files
authored
fix: skip watchPackageDataPlugin for worker builds (#14762)
1 parent 521ca58 commit 9babef5

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

packages/vite/src/node/build.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -893,15 +893,6 @@ export function onRollupWarning(
893893
return
894894
}
895895

896-
// Rollup tracks the build phase slightly earlier before `buildEnd` is called,
897-
// so there's a chance we can call `this.addWatchFile` in the invalid phase. Skip for now.
898-
if (
899-
warning.plugin === 'vite:worker-import-meta-url' &&
900-
warning.pluginCode === 'INVALID_ROLLUP_PHASE'
901-
) {
902-
return
903-
}
904-
905896
if (warningIgnoreList.includes(warning.code!)) {
906897
return
907898
}

packages/vite/src/node/plugins/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export async function resolvePlugins(
3232
postPlugins: Plugin[],
3333
): Promise<Plugin[]> {
3434
const isBuild = config.command === 'build'
35+
const isWorker = config.isWorker
3536
const buildPlugins = isBuild
3637
? await (await import('../build')).resolveBuildPlugins(config)
3738
: { pre: [], post: [] }
@@ -47,7 +48,7 @@ export async function resolvePlugins(
4748
]
4849
: []),
4950
isBuild ? metadataPlugin() : null,
50-
watchPackageDataPlugin(config.packageCache),
51+
!isWorker ? watchPackageDataPlugin(config.packageCache) : null,
5152
preAliasPlugin(config),
5253
aliasPlugin({ entries: config.resolve.alias }),
5354
...prePlugins,

0 commit comments

Comments
 (0)