diff --git a/src/components/LoadButton/index.jsx b/src/components/LoadButton/index.jsx index f1d72e4d..db9a31c8 100644 --- a/src/components/LoadButton/index.jsx +++ b/src/components/LoadButton/index.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { remote } from 'electron'; // eslint-disable-line import/no-extraneous-dependencies +import remote from '@electron/remote'; import PropTypes from 'prop-types'; import Button from 'react-bootstrap/Button'; diff --git a/src/components/SaveFileButton/index.jsx b/src/components/SaveFileButton/index.jsx index 5944cac7..bbde9367 100644 --- a/src/components/SaveFileButton/index.jsx +++ b/src/components/SaveFileButton/index.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { remote } from 'electron'; // eslint-disable-line import/no-extraneous-dependencies +import remote from '@electron/remote'; import PropTypes from 'prop-types'; import Button from 'react-bootstrap/Button'; diff --git a/src/components/SetupTab/ArgsForm/index.jsx b/src/components/SetupTab/ArgsForm/index.jsx index 4a795f7c..387b7a2c 100644 --- a/src/components/SetupTab/ArgsForm/index.jsx +++ b/src/components/SetupTab/ArgsForm/index.jsx @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { remote } from 'electron'; // eslint-disable-line import/no-extraneous-dependencies +import remote from '@electron/remote'; import Form from 'react-bootstrap/Form'; diff --git a/src/constants.js b/src/constants.js index e9275c59..c33ce15d 100644 --- a/src/constants.js +++ b/src/constants.js @@ -1,5 +1,5 @@ import path from 'path'; -import { remote } from 'electron'; // eslint-disable-line import/no-extraneous-dependencies +import remote from '@electron/remote'; const USER_DATA = remote.app.getPath('userData'); diff --git a/src/index.js b/src/index.js index 8755cfd2..ec520b45 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,5 @@ -const { remote, ipcRenderer } = require('electron'); // eslint-disable-line import/no-extraneous-dependencies +const { ipcRenderer } = require('electron'); // eslint-disable-line import/no-extraneous-dependencies +const remote = require('@electron/remote'); const isDevMode = remote.process.argv[2] === '--dev'; if (isDevMode) { @@ -51,5 +52,5 @@ ipcRenderer.on('variable-reply', (event, arg) => { // render the App after receiving any critical data // from the main process render(arg.investExe); -}) +}); ipcRenderer.send('variable-request', 'ping'); diff --git a/src/logger.js b/src/logger.js index 78a06f04..b6161f8b 100644 --- a/src/logger.js +++ b/src/logger.js @@ -1,12 +1,13 @@ const path = require('path'); const winston = require('winston'); require('winston-daily-rotate-file'); -const { app, remote } = require('electron'); +const { app } = require('electron'); let userDataPath; let isDevMode; -if (remote) { - // When this module is imported from render process, access via remote +if (process && process.type === 'renderer') { + // When this module is imported from renderer process, access via remote + const remote = require('@electron/remote'); userDataPath = remote.app.getPath('userData'); isDevMode = remote.process.argv[2] === '--dev'; } else { diff --git a/src/main.js b/src/main.js index 78fa420c..081bef7c 100644 --- a/src/main.js +++ b/src/main.js @@ -1,3 +1,5 @@ +require('@electron/remote/main').initialize(); + const isDevMode = process.argv[2] === '--dev'; if (isDevMode) { // in dev mode we can have babel transpile modules on import @@ -45,6 +47,7 @@ const createWindow = async () => { useContentSize: true, webPreferences: { nodeIntegration: true, + enableRemoteModule: true, }, });