- Bun (tested with 1.3.x)
- No node/npm required
bun devStarts on http://localhost:3000. TypeScript is bundled on-the-fly by Bun on each request to /app.js. Editing any file in src/ or index.html triggers a browser reload via WebSocket.
mkdir -p dist
bun run build.tsProduces dist/flexisender.html — a single self-contained HTML file with all JS inlined and minified. The dev-reload snippet is stripped. Three.js is still loaded from CDN.
index.html — markup + CSS, loads /app.js in dev, inlined in release
serve.ts — Bun dev server (port 3000, live reload)
build.ts — produces dist/flexisender.html
package.json — scripts: dev, build
src/ — TypeScript source modules
- Create
src/yourmodule.ts - Import and wire it in
src/main.ts - If it has functions called from HTML
onclickhandlers, expose them onwindowinmain.ts
- Three.js is loaded from CDN (
<script>inindex.html), accessed viadeclare const THREE: anyin TS files - All mutable shared state lives in
src/state.ts - HTML
onclickhandlers call global functions — these are assigned towindowinmain.ts - The build step inlines the bundled JS back into the HTML to preserve the single-file distribution model