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).
This commit is contained in:
Doxa Maps 2026-09-27 04:45:37 +00:00
parent e9e1adc0d6
commit e85ed5269a

View file

@ -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