saltyshiomix / nextron

⚡ Next.js + Electron ⚡
https://npm.im/nextron
MIT License
3.88k stars 223 forks source link

Module not found: Can't resolve 'fs' #409

Closed hamasbutt786 closed 12 months ago

hamasbutt786 commented 12 months ago

image

@saltyshiomix

When i use import electron in my next js environment in the render it shows this kind of error. How am i able to fix it.

bm777 commented 12 months ago

@hamasbutt786

In a Next.js project (or even in Nextron by inheritance), the fs (File System) module cannot be imported and used directly. The fs module is a core Node.js module for interacting with the file system. There are several reasons why you cannot use it directly in Next.js for client-side code.

But you can use IPC, and get fs used in node.js backend.

hamasbutt786 commented 12 months ago

@bm777

isn't the ipc is getting imported from electron?

hamasbutt786 commented 12 months ago

@bm777

my code is showing like this can you help here?

Its still showing me the same error as given in the subject.

code

bm777 commented 12 months ago

@hamasbutt786 please can you paste the code instead of the picture? Thanks