'Selectize and Electron stop work with webPreferences
I have problem with selectize with Electron framework. It work just fine until I do not include
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
then I receive error:
Uncaught TypeError: Cannot read properties of undefined (reading 'fn')
Without this I can not use ipcRenderer. Any idea, or any idea how to communicate with Electron backend without ipcRenderer/ipcMain.
I also use Angular, so code looks like:
const electron = require('electron');
const {ipcRenderer} = electron;
function sendAsync(key, message) {
ipcRenderer.send(key, message);
}
function sendSync(key, message, callback) {
callback(ipcRenderer.sendSync(key, message));
}
var bdexApp = angular.module('bdexApp', [
'ui.router', // Angular flexible routing
'selectize',
]);
And electron part like this:
mainWindow = new BrowserWindow({
x: config.window.x,
y: config.window.y,
width: config.window.width,
height: config.window.height,
webPreferences: {
nodeIntegration: true,
contextIsolation: false
}
});
Without webPreferences-nodeIntegration and CI, I receive error - require is not defined.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
