diff --git a/docs/api/remote.md b/docs/api/remote.md index 0bed3ad9b511..2abb2a843110 100644 --- a/docs/api/remote.md +++ b/docs/api/remote.md @@ -141,6 +141,36 @@ The `remote` module has the following methods: * `module` String Returns `any` - The object returned by `require(module)` in the main process. +Modules specified by their relative path will resolve relative to the entrypoint +of the main process. + +e.g. + +``` +project/ +├── main +│   ├── foo.js +│   └── index.js +├── package.json +└── renderer + └── index.js +``` + +```js +// main process: main/index.js +const {app} = require('electron') +app.on('ready', () => { /* ... */ }) +``` + +```js +// some relative module: main/foo.js +module.exports = 'bar' +``` + +```js +// renderer process: renderer/index.js +const foo = require('electron').remote.require('./foo') // bar +``` ### `remote.getCurrentWindow()`