Using a StencilJS project with Electron for Capacitor

I get this error:

Failed to load module script: The server responded with a non-JavaScript MIME type of "". Strict MIME type checking is enforced for module scripts per HTML spec.

To be honest I tried changing the baseUrl in the stencil config and tried commenting this line:

<script type="module" src="./build/app.esm.js"></script>

Just to make sure that it runs the es5 app.js

<script nomodule src="./build/app.js"></script>

But that didn’t work either. I don’t know what else to do anymore.

You’re supposed to be able to set the baseURL (https://stenciljs.com/docs/www) to address this, I think, but I’m having similar issues. When I modified the index.html file changing all /build and /asset references to build and asset I was able to get further, but then I ran into similar path issues in the router.

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

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