Reputation: 14824
Simple question, I'm trying to use electron and I need to get the remote
object on the client.
Doing
const {BrowserWindow} = require('electron').remote; // Works
But
import {BrowserWindow} from 'electron/remote' // Does not work
New to ES6 classes just unsure why this is not working. Thanks.
Upvotes: 10
Views: 11934
Reputation: 446
You can only import from modules. electron/remote
is not a module, but remote
is part of the module electron
, so you can write :
import remote from "electron";
And then you can do :
const {BrowserWindow} = remote;
But your first code works fine ! You can read more on import statement here
Hope this helps
Upvotes: 7
Reputation: 8781
I think you're supposed to use it like this:
import {remote} from 'electron'
// do something with remote.BrowserWindow
Upvotes: 0