fuzzc0re / electron-svelte-typescript

Advanced template for Electron apps with Svelte and Typescript.
MIT License
44 stars 4 forks source link

Dist version tries to connect to http://localhost:5000/ and crashes on startup #4

Closed ThomasOrlita closed 3 years ago

ThomasOrlita commented 3 years ago

I'm trying to get this template to work when the app is packaged, however it tries to connect to localhost and crashes when it's built.

git clone https://github.com/fuzzc0re/electron-svelte-typescript MyAppName
cd MyAppName
npm i
npm run build
npm run dist

now run the installer in dist and open the installed exe:

20:38:28.247 > App starting...
20:38:28.307 > Checking if settings store works correctly.
20:38:28.312 > Settings store works correctly.
20:38:28.398 > {
  preventDefault: '[function] function preventDefault() { [native code] }',
  sendReply: '[function] function sendReply() { [native code] }'
}
20:38:29.877 > {
  preventDefault: '[function] function preventDefault() { [native code] }',
  sendReply: '[function] function sendReply() { [native code] }'
}
20:38:37.143 > {"errno":-102,"code":"ERR_CONNECTION_REFUSED","url":"http://localhost:5000/"}
ThomasOrlita commented 3 years ago

Turns out for some reason the process.env.NODE_ENV is null. When I simply set isProd to true, it builds and runs without problems. Maybe electron-is-dev could be used instead.