Pascal Lieverse
Pascal Lieverse

Reputation: 65

Electron import library on remote with webpack

I am trying to convert my current code into a webpack js file. But I don't know how I can include a library on the remote variabel of Electron.

current code:

const { remote } = require('electron');
var windowManager = remote.require('electron-window-manager');

webpack file:

import {remote} from 'electron';

How do I import the windowManager on the remote import?

Upvotes: 0

Views: 899

Answers (1)

Nishkal Kashyap
Nishkal Kashyap

Reputation: 998

Here's how:

1.In the main process

const windowManager = require('electron-window-manager');
global.winMgr = windowManager;

2.In The renderer process

const {getGlobal} = require('electron').remote;
const winMgr = getGlobal('winMgr');

Upvotes: 1

Related Questions