Understand the limitations of single-file builds
mainCore Concept: Single Entry Point
This plugin is designed to create exactly one HTML file and no other files. It is not optimized for, and will not work well with, applications requiring multiple entry points (multiple HTML files).
Local File Execution (file:///)
When running the resulting HTML file locally (without a web server), certain behaviors apply:
What works:
localStorageand experimental Persistent Storage APIs- FileSystem API
- Relative requests for local files (e.g., resources from your
publicfolder) - Requests for images/fonts from external websites
- Requests to external APIs (requires
{ mode: 'no-cors' }infetch) - SPA hash-based routing
- WebXR
What does NOT work:
- SPA routing via Web History API
- Cookies (as they rely on HTTP headers which don't exist for
file:///URIs) - WebXR Immersive Mode (not currently supported)
- Worklets (not currently supported)
- Sourcemaps (inlining happens after they are generated)
Asset Caveats
- Public Folder: Static resources in the
publicfolder (likefavicon) are NOT inlined by Vite or this plugin. However, the single HTML file can still reference them using relative paths. - SVGs: Direct inlining of SVGs is not supported by Vite or this plugin. Use a loader like
vite-svg-loaderor embed SVGs directly in your templates.