Skip to content

Commit d0f6c31

Browse files
committed
chore(electron): disable electron node integration to fix jquery
1 parent 1652b8d commit d0f6c31

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

skeleton-esnext/index.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ app.on('window-all-closed', () => {
1818
app.on('ready', () => {
1919
mainWindow = new BrowserWindow({
2020
width: 800,
21-
height: 600
21+
height: 600,
22+
// Note: The following line turns off Node integration to allow
23+
// jQuery to work properly. If you need Node integration, please
24+
// see the Electron FAQ for how to enable this:
25+
// http://electron.atom.io/docs/faq/
26+
webPreferences: {
27+
nodeIntegration: false
28+
}
2229
});
2330

2431
mainWindow.loadURL(`file://${__dirname}/index.html`);

skeleton-typescript/index.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,21 @@ app.on('window-all-closed', () => {
1818
app.on('ready', () => {
1919
mainWindow = new BrowserWindow({
2020
width: 800,
21-
height: 600
21+
height: 600,
22+
// Note: The following line turns off Node integration to allow
23+
// jQuery to work properly. If you need Node integration, please
24+
// see the Electron FAQ for how to enable this:
25+
// http://electron.atom.io/docs/faq/
26+
webPreferences: {
27+
nodeIntegration: false
28+
}
2229
});
2330

2431
mainWindow.loadURL(`file://${__dirname}/index.html`);
2532
mainWindow.webContents.on('did-finish-load', () => {
2633
mainWindow.setTitle(app.getName());
2734
});
28-
35+
2936
mainWindow.on('closed', () => {
3037
mainWindow = null;
3138
});

0 commit comments

Comments
 (0)