I tried using
const { systemPreferences } = require('electron')
but it is causing this error
ERROR in ./node_modules/electron/index.js
Invalid dependencies have been reported by plugins or loaders for this module. All reported dependencies need to be absolute paths.
Project was created using electron-forge
Here is configuration for electron:
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: MAIN_WINDOW_WEBPACK_ENTRY,
// webSecurity: false,
// allowRunningInsecureContent: true,
nodeIntegration: true,
},
});
// and load the index.html of the app.
mainWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY);
mainWindow.setTitle("DMCA - Client")
// Open the DevTools.
mainWindow.webContents.openDevTools();
I also tried using nativeTheme
but importing electron is causing ‘fs’ not found error