Closed abarke closed 4 months ago
When starting nuxt it even says it's opening on 3000:
But VITE_DEV_SERVER_URL=http://localhost:51622
🤔
All very confusing 😵💫
This one is definitely strange. When I change the electron/main.ts
it rebuilds but does not update in electron-dist
🤔 if I remove the existing main.js
, electron fail to run with Unable to find electron app
.
OK... now I found the issue. I stupidly missed a dependency upgrade regression/migration issue import error in the electron logs, so it failed to build the main.js
file. Electron however would still open as the preload.ts
was there and an old version of the main.js
giving the illusion of caching.
Now I fixed the error and main.js
is building again, normality is restored and I'm a happy chappy 🙂 what a ride 🚵
In Nuxt we should not read from VITE_DEV_SERVER_URL
which is set by this module. As you've seen, it's a random port.
I think the following is the right URL for window to load:
win.loadURL(JSON.parse(process.env.__NUXT_DEV__!).proxy.url)
According electron tutorial ESM modules support could vary according required build.
Recommended is to client builds of vite so nuxt should support client side rendering and build without ssr and maybe expose some ipc isolations and sandbox webpreferences.
Since upgrading electron, nuxt and nuxt-electron, electron does not respect the line anymore:
Previously this worked. But now electron ignores this and uses
VITE_DEV_SERVER_URL
VITE_DEV_SERVER_URL
is always set to a random portI seem to remember that some time ago it was always port 3000. I need to explicity set it to 3000 as I want to persist localstorage and user session.
How can I fix this so electron in dev/prod mode always used port 3000?