diff --git a/packages/vite/src/esbuild-request.ts b/packages/vite/src/esbuild-request.ts index f2f25e0dd..d9c028430 100644 --- a/packages/vite/src/esbuild-request.ts +++ b/packages/vite/src/esbuild-request.ts @@ -12,7 +12,7 @@ type PackageCache = PublicAPI<_PackageCache>; export class EsBuildModuleRequest implements ModuleRequest { static from( packageCache: PackageCache, - phase: 'bundling' | 'scanning', + phase: 'bundling' | 'other', context: PluginBuild, kind: ImportKind, source: string, @@ -42,7 +42,7 @@ export class EsBuildModuleRequest implements ModuleRequest { private constructor( private packageCache: PackageCache, - private phase: 'bundling' | 'scanning', + private phase: 'bundling' | 'other', private context: PluginBuild, private kind: ImportKind, readonly specifier: string, diff --git a/packages/vite/src/esbuild-resolver.ts b/packages/vite/src/esbuild-resolver.ts index ace8d1db4..e3ee2bc20 100644 --- a/packages/vite/src/esbuild-resolver.ts +++ b/packages/vite/src/esbuild-resolver.ts @@ -153,14 +153,12 @@ export function esBuildResolver(): EsBuildPlugin { }; } -function detectPhase(build: PluginBuild): 'bundling' | 'scanning' { +function detectPhase(build: PluginBuild): 'bundling' | 'other' { let plugins = (build.initialOptions.plugins ?? []).map(p => p.name); if (plugins.includes('vite:dep-pre-bundle')) { return 'bundling'; - } else if (plugins.includes('vite:dep-scan')) { - return 'scanning'; } else { - throw new Error(`cannot identify what phase vite is in. Saw plugins: ${plugins.join(', ')}`); + return 'other'; } } diff --git a/tests/scenarios/vite-internals-test.ts b/tests/scenarios/vite-internals-test.ts index 60cb58542..765e1ab9b 100644 --- a/tests/scenarios/vite-internals-test.ts +++ b/tests/scenarios/vite-internals-test.ts @@ -76,6 +76,12 @@ appScenarios `, 'epsilon.hbs': `