diff --git a/src/node/config.ts b/src/node/config.ts index bad04536899b00..0f07871be6b1d9 100644 --- a/src/node/config.ts +++ b/src/node/config.ts @@ -488,7 +488,6 @@ export async function resolveConfig(mode: string, configPath?: string) { const cwd = process.cwd() let resolvedPath: string | undefined - let isTS = false if (configPath) { resolvedPath = path.resolve(cwd, configPath) } else { @@ -498,7 +497,6 @@ export async function resolveConfig(mode: string, configPath?: string) { } else { const tsConfigPath = path.resolve(cwd, 'vite.config.ts') if (fs.existsSync(tsConfigPath)) { - isTS = true resolvedPath = tsConfigPath } } @@ -511,6 +509,8 @@ export async function resolveConfig(mode: string, configPath?: string) { } } + const isTS = resolvedPath.endsWith('.ts') + try { let userConfig: UserConfig | ((mode: string) => UserConfig) | undefined