From b215c1ffd544a6042634db14c53b7a78d6f469b6 Mon Sep 17 00:00:00 2001 From: "hyunduk.kim" Date: Wed, 8 Apr 2020 18:00:23 +0900 Subject: [PATCH] Add the option to enable node integration in BrowserWindow To use node in renderer in case of electron app in m76, nodeIntegration must be set as true explicitly when creating an instance of BrowserWindow. Change-Id: I13126b22c843c177821c4670d6969bf8425e9251 Signed-off-by: hyunduk.kim --- main.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 13a9d26..1e074a3 100755 --- a/main.js +++ b/main.js @@ -21,7 +21,13 @@ app.on('window-all-closed', function() { app.on('ready', function() { console.log('ready'); // Create the browser window. - mainWindow = new BrowserWindow({width: 800, height: 600}); + mainWindow = new BrowserWindow({ + width: 800, + height: 600, + webPreferences: { + nodeIntegration: true + } + }); // and load the index.html of the app. mainWindow.loadURL('file://' + __dirname + '/index.html'); -- 2.34.1