[Electron / Debug] require is not defined

clean·2023년 6월 23일
0

err

ReferenceError: require is not defined

nodeIntegration의 기본 값이 false로 되어있기 때문에 이를 true로 만들어주면 해결된다.

app.on('ready', () => {
    var path = app.getAppPath()

    console.log(__dirname)
    mainWindow = new BrowserWindow({
        webPreferences: {
            nodeIntegration: true,
            contextIsolation: false,
        }
    });
    mainWindow.loadURL(`file://${app.getAppPath()}/index.html`);
    mainWindow.on('closed', () => { mainWindow = null; });
});

출처:
https://stackoverflow.com/questions/44391448/electron-require-is-not-defined

profile
블로그 이전하려고 합니다! 👉 https://onfonf.tistory.com 🍀

0개의 댓글

관련 채용 정보