From ec00b94be50759cb3dfc901f960895e9132caf09 Mon Sep 17 00:00:00 2001 From: Abhinav Raut Date: Sat, 19 Sep 2026 03:48:34 +0530 Subject: [PATCH] speed up builds and load app layouts on demand --- Makefile | 10 ++++------ frontend/apps/main/index.html | 2 +- frontend/apps/main/src/router/index.js | 25 ++++++++++--------------- frontend/apps/widget/index.html | 2 +- frontend/pnpm-lock.yaml | 10 +++++----- 5 files changed, 21 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 51a08865..6ed9d630 100644 --- a/Makefile +++ b/Makefile @@ -30,10 +30,7 @@ install-deps: $(STUFFBIN) # Build the frontend for production (both apps). .PHONY: frontend-build -frontend-build: install-deps - @echo "→ Building frontend for production - main app & widget..." - @export VITE_APP_VERSION="${VERSION}" && cd ${FRONTEND_DIR} && pnpm build:main - @export VITE_APP_VERSION="${VERSION}" && cd ${FRONTEND_DIR} && pnpm build:widget +frontend-build: frontend-build-main frontend-build-widget # Build only the main frontend app. .PHONY: frontend-build-main @@ -81,13 +78,14 @@ run-frontend-widget: .PHONY: build-backend build-backend: $(STUFFBIN) @echo "→ Building backend..." - @CGO_ENABLED=0 go build -a \ + @CGO_ENABLED=0 go build \ -ldflags="-X 'main.buildString=${BUILDSTR}' -X 'main.versionString=${VERSION}' -X 'github.com/abhinavxd/libredesk/internal/version.Version=${VERSION}' -s -w" \ -o ${BIN} cmd/*.go # Main build target: builds both frontend and backend, then stuffs static assets into the binary. .PHONY: build -build: frontend-build build-backend stuff +build: frontend-build build-backend + @$(MAKE) --no-print-directory stuff @echo "→ Build successful. Current version: $(VERSION)" # Stuff static assets into the binary using stuffbin. diff --git a/frontend/apps/main/index.html b/frontend/apps/main/index.html index 63340480..1ce7e812 100644 --- a/frontend/apps/main/index.html +++ b/frontend/apps/main/index.html @@ -9,7 +9,7 @@ - + diff --git a/frontend/apps/main/src/router/index.js b/frontend/apps/main/src/router/index.js index 7ea886b3..e6f16410 100644 --- a/frontend/apps/main/src/router/index.js +++ b/frontend/apps/main/src/router/index.js @@ -1,17 +1,12 @@ import { createRouter, createWebHistory } from 'vue-router' -import App from '@main/App.vue' -import OuterApp from '@main/OuterApp.vue' -import InboxLayout from '@main/layouts/inbox/InboxLayout.vue' -import AccountLayout from '@main/layouts/account/AccountLayout.vue' -import AdminLayout from '@main/layouts/admin/AdminLayout.vue' -import { useAppSettingsStore } from '../stores/appSettings' -import { getI18n } from '../i18n' -import { abortRouteScope } from '../api' +import { useAppSettingsStore } from '@main/stores/appSettings' +import { getI18n } from '@main/i18n' +import { abortRouteScope } from '@main/api' const routes = [ { path: '/', - component: OuterApp, + component: () => import('@main/OuterApp.vue'), children: [ { path: '', @@ -35,7 +30,7 @@ const routes = [ }, { path: '/', - component: App, + component: () => import('@main/App.vue'), children: [ { path: 'contacts', @@ -66,7 +61,7 @@ const routes = [ path: '/inboxes/teams/:teamID', name: 'teams', props: true, - component: InboxLayout, + component: () => import('@main/layouts/inbox/InboxLayout.vue'), meta: { titleKey: 'globals.terms.teamInbox', hidePageHeader: true }, children: [ { @@ -90,7 +85,7 @@ const routes = [ path: '/inboxes/views/:viewID', name: 'views', props: true, - component: InboxLayout, + component: () => import('@main/layouts/inbox/InboxLayout.vue'), meta: { titleKey: 'globals.terms.view', hidePageHeader: true }, children: [ { @@ -120,7 +115,7 @@ const routes = [ path: '/inboxes/:type(assigned|unassigned|all|mentioned)?', name: 'inboxes', redirect: '/inboxes/assigned', - component: InboxLayout, + component: () => import('@main/layouts/inbox/InboxLayout.vue'), props: true, meta: { titleKey: 'globals.terms.inbox', hidePageHeader: true }, children: [ @@ -164,7 +159,7 @@ const routes = [ path: '/account/:page?', name: 'account', redirect: '/account/profile', - component: AccountLayout, + component: () => import('@main/layouts/account/AccountLayout.vue'), props: true, meta: { titleKey: 'globals.terms.account' }, children: [ @@ -186,7 +181,7 @@ const routes = [ { path: '/admin', name: 'admin', - component: AdminLayout, + component: () => import('@main/layouts/admin/AdminLayout.vue'), meta: { titleKey: 'globals.terms.admin' }, children: [ { diff --git a/frontend/apps/widget/index.html b/frontend/apps/widget/index.html index 66ac7efe..61b57d1b 100644 --- a/frontend/apps/widget/index.html +++ b/frontend/apps/widget/index.html @@ -7,7 +7,7 @@ libredesk Chat Widget - + diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index 0fa33df3..3e0f6ff6 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -1751,8 +1751,8 @@ packages: resolution: {integrity: sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==} engines: {node: '>= 6'} - caniuse-lite@1.0.30001784: - resolution: {integrity: sha512-WU346nBTklUV9YfUl60fqRbU5ZqyXlqvo1SgigE1OAXK5bFL8LL9q1K7aap3N739l4BvNqnkm3YrGHiY9sfUQw==} + caniuse-lite@1.0.30001810: + resolution: {integrity: sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==} caseless@0.12.0: resolution: {integrity: sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==} @@ -5464,7 +5464,7 @@ snapshots: autoprefixer@10.4.20(postcss@8.5.23): dependencies: browserslist: 4.24.4 - caniuse-lite: 1.0.30001784 + caniuse-lite: 1.0.30001810 fraction.js: 4.3.7 normalize-range: 0.1.2 picocolors: 1.1.1 @@ -5528,7 +5528,7 @@ snapshots: browserslist@4.24.4: dependencies: - caniuse-lite: 1.0.30001784 + caniuse-lite: 1.0.30001810 electron-to-chromium: 1.5.80 node-releases: 2.0.19 update-browserslist-db: 1.1.2(browserslist@4.24.4) @@ -5556,7 +5556,7 @@ snapshots: camelcase-css@2.0.1: {} - caniuse-lite@1.0.30001784: {} + caniuse-lite@1.0.30001810: {} caseless@0.12.0: {}