diff --git a/scripts/build-front.sh b/scripts/build-front.sh index 37a1b2a41f..0c7a9e2fd5 100755 --- a/scripts/build-front.sh +++ b/scripts/build-front.sh @@ -6,9 +6,7 @@ CURR_DIR=$(cd "$(dirname "$0")" && pwd) cd "$CURR_DIR"/../webapp -# When the web application is running in Desktop mode, -# the web app is served at the `/static` entry point. -npm run build -- --base=/static/ +npm run build -- --mode=desktop-app cd .. rm -fr resources/webapp diff --git a/webapp/vite.config.ts b/webapp/vite.config.ts index 1acfabe928..898772748e 100644 --- a/webapp/vite.config.ts +++ b/webapp/vite.config.ts @@ -4,15 +4,22 @@ import react from "@vitejs/plugin-react-swc"; const SERVER_URL = "http://localhost:8080"; // https://vitejs.dev/config/ -export default defineConfig({ - plugins: [react({ devTarget: "es2022" })], - server: { - port: 3000, - strictPort: true, - proxy: { - "/v1": SERVER_URL, - "/version": SERVER_URL, - "/ws": SERVER_URL, +export default defineConfig(({ mode }) => { + const isDesktopAppMode = mode === "desktop-app"; + + return { + // When the web application is running in Desktop mode, + // the web app is served at the `/static` entry point + base: isDesktopAppMode ? "/static/" : "/", + plugins: [react({ devTarget: "es2022" })], + server: { + port: 3000, + strictPort: true, + proxy: { + "/v1": SERVER_URL, + "/version": SERVER_URL, + "/ws": SERVER_URL, + }, }, - }, + }; });