From e85ed5269ab60753b2749d31410d6a712099fbf3 Mon Sep 17 00:00:00 2001 From: Doxa Maps Date: Sun, 27 Sep 2026 04:45:37 +0000 Subject: [PATCH] A cold bun run dev mounts on the first load: pre-bundle the leaves' dependencies rega measured it on all 40 dev pages: on a cold start every page's first load got "504 (Outdated Optimize Dep)" on vue.js and pinia.js, Vite re-optimised, and nothing mounted until a reload. optimizeDeps.include now names every bare runtime import in library/ and plugin-designs/ (vue, vue-i18n, pinia) plus jspdf, loaded lazily on poster export. The map engines and d3 are pinned CDN scripts, not imports. Needs eyes: a cold start plus one page load (rega). --- vite.config.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vite.config.js b/vite.config.js index 42c7eae9e..e58edb145 100644 --- a/vite.config.js +++ b/vite.config.js @@ -163,6 +163,13 @@ export default defineConfig(({ command, mode }) => { resolve: { alias: { '@map': resolve(__dirname, 'library') }, }, + // COLD `bun run dev` (rega, all 40 dev pages): the first load of every page got "504 (Outdated Optimize + // Dep)" on vue.js / pinia.js, because Vite discovered them mid-request, re-optimised, and invalidated the + // page before it mounted. Naming the bare packages the leaves import makes Vite pre-bundle them at + // startup. These are EVERY bare runtime import in library/ and plugin-designs/ (vue, vue-i18n, pinia) + // plus jspdf, loaded lazily on poster export and so otherwise re-optimised on the first export. The map + // engines and d3 are pinned CDN scripts, not imports. + optimizeDeps: { include: ['vue', 'vue-i18n', 'pinia', 'jspdf'] }, // NEVER copy public/ into a bundle's output. Vite's default publicDir is // 'public', and the build runs vite ONCE PER PROFILE — so the default copied // the entire 95MB shared asset tree into all nine bundle folders, taking the