Skip to content

Commit

Permalink
fix: skip watchPackageDataPlugin for worker builds (#14762)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Oct 26, 2023
1 parent 521ca58 commit 9babef5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
9 changes: 0 additions & 9 deletions packages/vite/src/node/build.ts
Expand Up @@ -893,15 +893,6 @@ export function onRollupWarning(
return
}

// Rollup tracks the build phase slightly earlier before `buildEnd` is called,
// so there's a chance we can call `this.addWatchFile` in the invalid phase. Skip for now.
if (
warning.plugin === 'vite:worker-import-meta-url' &&
warning.pluginCode === 'INVALID_ROLLUP_PHASE'
) {
return
}

if (warningIgnoreList.includes(warning.code!)) {
return
}
Expand Down
3 changes: 2 additions & 1 deletion packages/vite/src/node/plugins/index.ts
Expand Up @@ -32,6 +32,7 @@ export async function resolvePlugins(
postPlugins: Plugin[],
): Promise<Plugin[]> {
const isBuild = config.command === 'build'
const isWorker = config.isWorker
const buildPlugins = isBuild
? await (await import('../build')).resolveBuildPlugins(config)
: { pre: [], post: [] }
Expand All @@ -47,7 +48,7 @@ export async function resolvePlugins(
]
: []),
isBuild ? metadataPlugin() : null,
watchPackageDataPlugin(config.packageCache),
!isWorker ? watchPackageDataPlugin(config.packageCache) : null,
preAliasPlugin(config),
aliasPlugin({ entries: config.resolve.alias }),
...prePlugins,
Expand Down

0 comments on commit 9babef5

Please sign in to comment.