Fixed wrong base path being used in vite config

This commit is contained in:
Alejandro Celaya
2022-12-31 18:15:47 +01:00
parent 7f6c678eaa
commit c078a5fb55
2 changed files with 20 additions and 2 deletions

View File

@@ -4,7 +4,8 @@ import { VitePWA } from 'vite-plugin-pwa';
import { manifest } from './manifest';
import pack from './package.json';
// https://vitejs.dev/config/
const homepage = pack.homepage?.trim();
export default defineConfig({
plugins: [react(), VitePWA({
mode: process.env.NODE_ENV === 'development' ? 'development' : 'production',
@@ -21,5 +22,5 @@ export default defineConfig({
server: {
port: 3000,
},
base: pack.homepage ?? '/',
base: !homepage ? undefined : homepage, // Not using just homepage because empty string should be discarded
});