BLOBBO/vite.config.ts
type-two 7918f9f6f1 fix(deploy): serve at monsterrobot.games/games/blobbo/ (relative base)
The arcade moved to monsterrobot.games, where every game lives under
/games/<name>/. BLOBBO's build was pinned to base '/blobbo/', so at the new
mount its absolute /blobbo/assets/... requests 404'd and the module loader got
HTML (the error John hit). Fix:

- vite base -> './' (relative). One build now works at ANY mount point:
  index.html + editor.html sit at the deploy root, assets resolve as
  ./assets/... against the (trailing-slash) page URL, and assetUrl() reads
  import.meta.env.BASE_URL='./' so the manifest resolves the same way. Verified
  by serving dist/ under a /games/blobbo/ subpath locally: game + editor boot,
  manifest fetch resolves to /games/blobbo/assets/manifest.json.

- deploy.sh publishes to the RIGHT place for each host. monsterrobot.games's
  docroot is bind-mounted READ-ONLY into forum-nginx from host
  /home/humanjing/monsterrobot.games/games/blobbo, so it's rsync'd on the host
  (docker cp is refused on the ro mount). partly.party's container-internal
  /blobbo stays a best-effort docker-cp copy. Both overlay (keep old chunks;
  prune >7d) and both are verified live (index 200 + entry chunk is JS).

Live-verified: monsterrobot.games/games/blobbo/ boots (world+blob, course
select, no console errors); partly.party/blobbo/ still boots too.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 11:22:12 +10:00

27 lines
1.1 KiB
TypeScript

import { defineConfig } from 'vite'
import { resolve } from 'path'
export default defineConfig({
// Relative base so ONE build works at any mount point: partly.party/blobbo/
// AND monsterrobot.games/games/blobbo/ (the arcade's /games/<name>/ layout).
// index.html + editor.html sit at the deploy root, so their assets resolve as
// ./assets/... against the (always trailing-slash) page URL. assetUrl() reads
// import.meta.env.BASE_URL='./' and resolves the manifest the same way.
base: './',
build: {
target: 'es2022',
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
editor: resolve(__dirname, 'editor.html'), // the Workshop — without this it exists only under `vite dev`
'lane-a': resolve(__dirname, 'demos/lane-a.html'),
'lane-b': resolve(__dirname, 'demos/lane-b.html'),
'lane-c': resolve(__dirname, 'demos/lane-c.html'),
'lane-f': resolve(__dirname, 'demos/lane-f.html'),
'lane-g': resolve(__dirname, 'demos/lane-g.html'),
'lane-h': resolve(__dirname, 'demos/lane-h.html'),
},
},
},
})