Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(config): detect TS when configPath is provided #1165

Merged
merged 1 commit into from
Nov 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(config): Detect TS when configPath is provided
  • Loading branch information
frandiox authored Nov 28, 2020
commit 641fb4852731438fe97ec03f914e345b23005c1a
4 changes: 2 additions & 2 deletions src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
}
Expand All @@ -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

Expand Down