Embedded static build in iframe (Electron Forge + Vite)
12:35 22 Jan 2026

In principle, all I'm looking to accomplish is embed a static build of a web app into an electron powered vite app.

Context

== File Structure ==

- public/
| - static_build/
  | - index.html
  | - ...

- index.html

- src/
| - main.ts
| - renderer.ts
| - ...

 to the index.html

Set appType to mpa in the vite renderer config so that it doesn't create an infinity mirror when it inevitably fails to load.

Voilà.

  • Run the development environment with npm start to see how it fails to find the index.html from the folder path.

  • Change the src to /static_build/index.html and run again to see how that breaks routing.

  • Change the src to ./static_build/ (and rebuild the embedded app with that base path) and package to see how that compounds.


Thank you very much in advance.

javascript iframe electron vite electron-forge