fix(vite): give each app its own cacheDir to stop dep-race 504s

VitePWA-disabled was supposed to fix stale dev artefacts but each
of the 8 vite servers was still sharing one node_modules/.vite/deps
directory. Concurrent dep optimization runs (any of: server
restart, config edit, new import) raced for that single cache,
producing intermittent 504 "Outdated Optimize Dep" responses for
hashes the requesting tab still held — followed by Vue Router
"Failed to fetch dynamically imported module" cascades when the
victim was a route component (e.g., MarketPage.vue).

Each app now has its own cache dir:
  hub        node_modules/.vite-hub
  castle     node_modules/.vite-castle
  activities node_modules/.vite-activities
  wallet     node_modules/.vite-wallet
  chat       node_modules/.vite-chat
  forum      node_modules/.vite-forum
  market     node_modules/.vite-market
  tasks      node_modules/.vite-tasks

Set via vite's `cacheDir` option in each config. No more racing.
.gitignore already covers node_modules so the new dirs are ignored
automatically.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Padreug 2026-05-02 14:56:58 +02:00
commit ae68eb09c4
8 changed files with 16 additions and 0 deletions

View file

@ -35,6 +35,8 @@ function tasksHtmlPlugin(): Plugin {
*/
export default defineConfig(({ mode }) => ({
base: process.env.VITE_BASE_PATH || '/',
// Per-app dep cache so concurrent dev servers don't race on .vite/deps
cacheDir: 'node_modules/.vite-tasks',
server: {
port: 5186,
strictPort: true,