diff --git a/client/vite.config.ts b/client/vite.config.ts index c19cbf218..b08e4dcb6 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -1,4 +1,3 @@ -import { defineConfig } from 'vite'; import reactRefresh from '@vitejs/plugin-react-refresh'; const sourcemap = process.env.SOURCEMAP === 'true'; @@ -30,14 +29,25 @@ PROXY_ROUTES.forEach((route) => { proxy['^/.*/api/app'] = PROXY_URL; // https://vitejs.dev/config/ -export default defineConfig({ - base: '/sqlpad/', - plugins: [reactRefresh()], - server: { - proxy, - }, - build: { - outDir: 'build', - sourcemap, - }, -}); +const getConfig = ({ command, mode }) => { + let base = undefined; + + // command is either build or serve + if (command === 'serve') { + base = '/sqlpad/'; + } + + return { + base, + plugins: [reactRefresh()], + server: { + proxy, + }, + build: { + outDir: 'build', + sourcemap, + }, + }; +}; + +export default getConfig;