toujours

electron 으로 file i/o 하기 중 require 오류해결. 본문

카테고리 없음

electron 으로 file i/o 하기 중 require 오류해결.

toujours_ 2021. 7. 30. 23:42

https://stackoverflow.com/questions/55093700/electron-5-0-0-uncaught-referenceerror-require-is-not-defined

 

electron 5.0.0 "Uncaught ReferenceError: require is not defined"

I had initially been using electron stable (4.x.x), and was able to use require in both my browser and renderer processes. I upgraded to electron beta (5.0.0) because I needed a newer version of no...

stackoverflow.com

 

 

  const mainWindow = new BrowserWindow({

    width: 800,

    height: 600,

    webPreferences: {

      preload: path.join(__dirname"preload.js"),

      nodeIntegration: true,

      contextIsolation: false,

      enableRemoteModule: true,

    },

  });

 

 

 

위와같이       

      nodeIntegration: true,

      contextIsolation: false,

      enableRemoteModule: true,

 

 

이렇게 세개  추가하여해결.

 

상위버전에서는 저렇게 해줘야 require쓸수있음.

 

 

 

반응형
Comments