Skip to content

Commit

Permalink
fix(api): Stop remote module usage for loading ipc
Browse files Browse the repository at this point in the history
  • Loading branch information
megahertz committed Jul 22, 2021
1 parent a0c2e89 commit 6a06eb6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 4.4.0
- Disable auto-loading of electron-log in the main process for using by ipc
transport

## 4.3.0
- Add `transport.file.inspectOptions`
- `transport.file.depth` is deprecated
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ When logging inside renderer process, it also shows log in application
console and vice versa. This transport can impact on performance, so
it's disabled by default for packaged application.

If you don't use electron-log in the main process but want to show renderer
logs in the console, add `require('electron-log')` somewhere in the main code.

##### Options

- **level**, default 'silly'
Expand Down
15 changes: 2 additions & 13 deletions src/electronApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,6 @@ function getPath(name) {
}
}

function getRemote() {
if (electron && electron.remote) {
return electron.remote;
}

return null;
}

function getVersion() {
var app = getApp();
if (!app) return null;
Expand Down Expand Up @@ -164,11 +156,8 @@ function loadRemoteModule(moduleName) {
}
});
} else if (process.type === 'renderer') {
try {
getRemote().require(moduleName);
} catch (e) {
// Can't be required. Webpack?
}
// Previously, it was electron.remote.require(moduleName)
// but now the remote module is deprecated
}
}

Expand Down

0 comments on commit 6a06eb6

Please sign in to comment.