dist/ directory. This guide covers general requirements and provider-specific considerations.
General Requirements
Any static host should meet these requirements:Point document root to dist/
Configure your hosting provider to serve from the
dist/ directory after build.Preserve directory structure
Maintain the complete directory structure:
dist/index.html(and other HTML entry points)dist/assets/**for hashed JS/CSS bundlesdist/.vite/manifest.jsonfor asset lookups
Serving the dist/ Folder
After building withbun run build, the dist/ folder contains everything needed for deployment:
Caching Configuration
Optimal caching strategy for Stims:Stims includes a
public/_headers file that Vite copies to dist/_headers. Cloudflare Pages automatically reads this file. For other platforms, translate these rules to your platform’s cache configuration format.Platform-Specific Setup
Netlify
Vercel
GitHub Pages
Local Static Server
Test static hosting locally using the included Bun server:dist/ directory as a static site and mimics production hosting behavior.
Build Artifacts Checklist
Before deploying, verify your build includes:HTML entry points
Check that all HTML files are present:Expected:
index.html, toy.html, and any toy-specific HTML files.Hashed assets
Verify hashed bundles exist:Expected: Files with content hashes (e.g.,
index-a1b2c3d4.js).Deployment Verification
After deploying to production, perform these checks:Verify assets load
Open browser DevTools and check:
- All JS/CSS files load from
/assets/with 200 status - No 404 errors in console
- Proper cache headers on assets (check Network tab)
Test entry points
Manually navigate to each HTML entry point:
/or/index.html/toy.html- Individual toys (e.g.,
/legible.html)
Validate functionality
Test core features:
- Page loads and renders correctly
- Audio input (microphone) permissions
- Interactive controls and touch/pointer events
- WebGL rendering works
Troubleshooting
Assets Return 404
If assets fail to load:- Verify build output directory is set to
dist - Check that
.vite/manifest.jsonexists - Ensure all files in
dist/assets/are being deployed - Confirm asset paths in HTML match deployed paths
Blank Page or JS Errors
If the page loads but shows errors:- Check browser console for specific errors
- Verify all JS bundles loaded successfully (Network tab)
- Ensure ES2020 features are supported by target browsers
- Test locally with
bun run previewto rule out build issues
Stale Content After Deploy
If updates don’t appear:- Check cache headers on HTML files (should not be cached long-term)
- Clear browser cache or test in incognito
- Verify HTML files have
must-revalidatedirective - Check CDN cache settings if using a CDN