New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
× TypeError: fs.existsSync is not a function #7
Comments
@tudiantuan, thank you for the report. But, I don't find such a problem at all. |
@yhirose this is common problem when trying to import |
@kunokdev, great! Could you show me the smallest possible code to reproduce it? |
Steps to reproduce:
This error appears: Perhaps changing import to:
could solve this problem. |
@kunokdev, do you think if it's a problem related to this project, or a typical Electron issue which can happen in any Electron project? |
I'd say It's caused by electron+cra(webpack) combo; Depends how you wanna look at it; this issue affects this repo; but this repo isn't the cause of the issue. You should probably add something in README or code example where renderer (React) process communicates with main (Electron) process. |
To use node modules and code in react, the webpack target needs to be CRA doesn't make it easy to modify webpack config, options are:
|
I am successfully using ipcRenderer without ejecting or preload scripts |
@kunokdev I see that using update this seems to work ok: import * as FS from "fs";
const fs: typeof FS = window.require("fs"); or: import { IpcRenderer } from 'electron'
const ipcRenderer: IpcRenderer = window.require('electron').ipcRenderer |
@stereosteve, There is a better fix: |
The text was updated successfully, but these errors were encountered: