sveltekit-electron icon indicating copy to clipboard operation
sveltekit-electron copied to clipboard

Adapter Node

Open ghost opened this issue 3 years ago • 22 comments

Is there a way to use @sveltejs/adapter-node ? It seems to works for dev but as soon as i build the app i only get a blank window.

ghost avatar Feb 01 '22 08:02 ghost

Hey- I haven't tried this yet. Did you manage to get it working?

braebo avatar Feb 06 '22 21:02 braebo

Do you have a code example to show the error? I would be willing to take a look at the issue.

navsubrm avatar Feb 07 '22 06:02 navsubrm

I have the same issue, the resulting app is empty. Is this project still in development ?

itssumitrai avatar May 14 '22 23:05 itssumitrai

Yep! PRs are welcome, wasn't able to get this working in my brief testing before @itssumitrai

ghostdevv avatar May 15 '22 20:05 ghostdevv

I'm also running into this problem. Has anyone found a solution to this yet?

JBloss1517 avatar Jul 19 '22 21:07 JBloss1517

There are solutions but they aren't worth the trouble IMO - what is your use case? @JBloss1517

ghostdevv avatar Jul 19 '22 21:07 ghostdevv

I was hoping to use the Sveltekit load function (or the new page endpoints) to get my data ahead of the page rendering, and was thinking that was going to require adapter-node to make work.

JBloss1517 avatar Jul 19 '22 21:07 JBloss1517

You should still be able to use a load function iirc - I will take a look tomorrow if there is a way we can make it more easy to expose the node adapter

ghostdevv avatar Jul 19 '22 22:07 ghostdevv

Awesome! Thank you

JBloss1517 avatar Jul 19 '22 23:07 JBloss1517

Hey, I started to take a look and have a few ideas - I am away till friday so will finish up saturday!

ghostdevv avatar Jul 21 '22 01:07 ghostdevv

That's so awesome of you, thank you!

JBloss1517 avatar Jul 22 '22 02:07 JBloss1517

Hey just wanted to check in on this? I have a use case for the node adapter especially with recent sveltekit updates

LukeHagar avatar Aug 17 '22 23:08 LukeHagar

I started work on an adapter and forgot to finish it! let me see if I can get any further with it this week - and will put what I got online regardless

ghostdevv avatar Aug 17 '22 23:08 ghostdevv

Was there a result/solution for this?

ogrotten avatar Oct 07 '22 19:10 ogrotten

Hey, How use +server.js? this not working

inday-jin avatar Jan 19 '23 05:01 inday-jin

I tried working on this, but it wouldn't let me install adapter-node. Instead, I just created a sample SvelteKit project using adapter-node and published it. If anyone wants to use it, the link is: https://github.com/navsubrm/svelte-electron-node-adapter/blob/master/index.cjs.

I haven't tested the build on windows, but it builds and runs fine on Mac. It should work with any imported SvelteKit app.

navsubrm avatar Jan 21 '23 01:01 navsubrm

@ghostdevv, did you ever push the changes you made? I am curious how you solved using the node adapter.

Nate561 avatar Apr 20 '23 20:04 Nate561

Works in win10 ;)

JohnRSim avatar Apr 25 '23 16:04 JohnRSim

any updates ?

ibilux avatar May 30 '23 13:05 ibilux

I tried working on this, but it wouldn't let me install adapter-node. Instead, I just created a sample SvelteKit project using adapter-node and published it. If anyone wants to use it, the link is: https://github.com/navsubrm/svelte-electron-node-adapter/blob/master/index.cjs.

I haven't tested the build on windows, but it builds and runs fine on Mac. It should work with any imported SvelteKit app.

@ibilux I'm using this and building packaging for Mac/Windows and it's working for me - electron/sveltekit with nodejs(sveltekit).

A few issues I had during working with it.. I have to run npm run dev:svelte/electron separately.

On build I have to make sure that sveltekit is not part of the app.asar

  • couldn't seem to get it to work if it was packaged etc..

JohnRSim avatar May 30 '23 13:05 JohnRSim

I haven't tested the build on windows, but it builds and runs fine on Mac. It should work with any imported SvelteKit app.

I'm trying to use it right now. It's a clever idea. I'll work with it I may can do something with the packaging.

ibilux avatar May 30 '23 15:05 ibilux

If you can figure out the packaging let me know - I wasted a day trying different things to get it to work - and ended up just leaving the build dir unpackaged wiith the config - using nsis for the package manager


		"files": [
			"app/**/*",
			"build/**/*",
			"index.cjs",
			"package.json",
			"preload.cjs"
		],
		"asarUnpack": [
			"build/**/*",
			"node_modules/**/*"
		]

JohnRSim avatar May 30 '23 17:05 JohnRSim

Also forgot to mention I'm using electron-builder for packaging -

npx electron-builder build --windows
npx electron-builder build --mac

JohnRSim avatar Jun 01 '23 10:06 JohnRSim