Skip to content

Commit

Permalink
feat(vite): throw an error if vite config is not found at provided pa…
Browse files Browse the repository at this point in the history
…th (#16600)
  • Loading branch information
dmitry-stepanenko authored Apr 28, 2023
1 parent d8f9af8 commit 94300fe
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/vite/src/utils/options-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,16 @@ export function normalizeViteConfigFilePath(
projectRoot: string,
configFile?: string
): string | undefined {
return configFile && existsSync(joinPathFragments(configFile))
? configFile
: existsSync(joinPathFragments(`${projectRoot}/vite.config.ts`))
if (configFile) {
const normalized = joinPathFragments(configFile);
if (!existsSync(normalized)) {
throw new Error(
`Could not find vite config at provided path "${normalized}".`
);
}
return normalized;
}
return existsSync(joinPathFragments(`${projectRoot}/vite.config.ts`))
? joinPathFragments(`${projectRoot}/vite.config.ts`)
: existsSync(joinPathFragments(`${projectRoot}/vite.config.js`))
? joinPathFragments(`${projectRoot}/vite.config.js`)
Expand Down

1 comment on commit 94300fe

@vercel
Copy link

@vercel vercel bot commented on 94300fe Apr 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx-five.vercel.app
nx.dev

Please sign in to comment.