electron-react-boilerplate / electron-react-boilerplate

A Foundation for Scalable Cross-Platform Apps

Home Page:https://electron-react-boilerplate.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uncaught TypeError: window.require is not a function

Eikb opened this issue · comments

Summary

When I type npm start, everything works as it should. But as soon as I type npm run package -- --mac and open the build, I get a blank page and in the console the error message

ProgramList.js:21 Uncaught TypeError: window.require is not a function
    at ProgramList.js:21:19
    at index.tsx:6:17
    at index.tsx:6:17 

That is all I have already done:
I followed this link:

then

webPreferences: {
      nodeIntegration: true,
      contextIsolation: false,
    },

then

fallback: { path: require.resolve('path-browserify'), 
    fs: false,
    tls: false,
    net: false,
    zlib: false,
    http: false,
    https: false,
    stream: false, },

I would be very happy about your help, because I've been sitting on the same problem for 5 days.

@Eikb Interested about this as well... I've faced similar issues...

are you trying to do something similar to

const {ipcRenderer} = window.require("electron") inside a React component?

Also the last file you posted what file is that?