sindresorhus / electron-util

Useful utilities for Electron apps and modules
MIT License
1.28k stars 63 forks source link

Can't use with Next.js #30

Closed saeta-eth closed 4 years ago

saeta-eth commented 4 years ago

Hi.

I can't use this library with Next.js. I see this error:

Module not found: Can't resolve 'fs' in '.../node_modules/electron'

Is there any workaround? Thanks!

sindresorhus commented 4 years ago

That is a problem with Next.js. You should open an issue there instead.

lacymorrow commented 4 years ago

@slorenzo that's usually an issue with trying to server-side render native modules. Make sure your code is being run only in the "Main" process.

saeta-eth commented 4 years ago

Thanks @lacymorrow. I found out a workaround here. But another error appears, so I decided not to use this package in the renderer process.

lacymorrow commented 4 years ago

No problem @slorenzo. If you're looking for a solution to build Electron with a statically-rendered React + Next.js app I can suggest Nextron.