ES module imports fail via file:// or raw Forge URLs (CORS + missing Content-Type). boot.js already detects this and warns users. Three deployment options: - ./preview.sh — local Python server, correct MIME types - docker compose up nexus-preview — nginx + WS proxy on :8080 - Push to main — GitHub Pages auto-deploy via CI Files: - Dockerfile.preview: nginx preview container - preview/nginx.conf: correct MIME types + /api/world/ws proxy - preview.sh: Python one-liner preview server - PREVIEW.md: deployment documentation - .github/workflows/pages.yml: GitHub Pages CI/CD - docker-compose.yml: added nexus-preview + nexus-backend - deploy.sh: added preview/full modes Fixes #1339
1.2 KiB
1.2 KiB
Nexus Preview Deployment
Deploy The Nexus to a proper URL so ES module imports work.
Problem
file:// and raw Forge URLs break ES module imports (CORS + wrong Content-Type).
boot.js already detects this: "Serve this world over HTTP to initialize Three.js."
Quick Start
./preview.sh # http://localhost:8080 (Python, no deps)
./preview.sh docker # http://localhost:8080 (nginx + WS proxy)
docker compose up -d nexus-preview nexus-backend # full stack
Deploy Options
| Method | Command | URL |
|---|---|---|
| Local Python | ./preview.sh |
http://localhost:8080 |
| Docker nginx | docker compose up nexus-preview |
http://localhost:8080 |
| GitHub Pages | push to main | auto-deploy |
| VPS nginx | copy files + nginx | your-domain.com |
Architecture
Browser ──► nginx :8080 ──► index.html, app.js, style.css, nexus/
│
└── /api/world/ws ──► proxy ──► nexus-backend :8765
Files
| File | Purpose |
|---|---|
Dockerfile.preview |
nginx preview container |
preview/nginx.conf |
MIME types + WebSocket proxy |
preview.sh |
Python preview server |
.github/workflows/pages.yml |
GitHub Pages auto-deploy |