Skip to content

Commit

Permalink
fix: check if config files exists (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
janvennemann authored Aug 15, 2024
1 parent f6e2a33 commit 7c8801c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/node/server.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import path from 'path';
import { ViteDevServer, createServer, normalizePath } from 'vite';
import path from 'node:path';
import { existsSync } from 'node:fs';
import type { ViteDevServer } from 'vite';
import { createServer, normalizePath } from 'vite';

import { runDynamicOptimize } from './optimizer';
import { resolvePlugins } from './plugins';
import { Platform, ProjectType } from './types';
import type { Platform, ProjectType } from './types';
import { CLIENT_DIR, CLIENT_ENTRY, ENV_ENTRY, FS_PREFIX } from './constants.js';

interface ProjectOptions {
Expand Down Expand Up @@ -39,8 +41,9 @@ export async function startServer({
OS_ANDROID: JSON.stringify(platform === 'android'),
OS_IOS: JSON.stringify(platform === 'ios')
};
const configFile = path.join(projectDir, 'vite.config.js');
const viteSever = await createServer({
configFile: path.join(projectDir, 'vite.config.js'),
configFile: existsSync(configFile) ? configFile : undefined,
clearScreen: false,
root,
build: {
Expand Down

0 comments on commit 7c8801c

Please sign in to comment.