Using a StencilJS project with Electron for Capacitor

You will want to look at the electron-serve package.

The next iteration of capacitor/electron will fix this issue in the base template.