From eba5bdf02c181b88a9a2bb2cbfce43e166d8dff7 Mon Sep 17 00:00:00 2001 From: Samir Kamal <1954121+skamril@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:47:07 +0100 Subject: [PATCH] build: fix issue with desktop app packaging for Windows --- .github/workflows/deploy.yml | 1 + scripts/build-front.sh | 2 +- webapp/vite.config.ts | 25 +++++++++++++++---------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 09535d94b9..8e3962450e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,6 +5,7 @@ on: branches: - "master" - "hotfix/**" + - "bugfix/desktop_build_windows" jobs: binary: diff --git a/scripts/build-front.sh b/scripts/build-front.sh index 37a1b2a41f..8f48625758 100755 --- a/scripts/build-front.sh +++ b/scripts/build-front.sh @@ -8,7 +8,7 @@ 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..510122d961 100644 --- a/webapp/vite.config.ts +++ b/webapp/vite.config.ts @@ -4,15 +4,20 @@ 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 { + base: isDesktopAppMode ? "/static/" : "/", + plugins: [react({ devTarget: "es2022" })], + server: { + port: 3000, + strictPort: true, + proxy: { + "/v1": SERVER_URL, + "/version": SERVER_URL, + "/ws": SERVER_URL, + }, }, - }, + }; });