admin管理员组文章数量:1320397
I recently upgraded to electron v1.3 from 0.37 and get Cannot find module 'remote' in the renderer process.
Been bing through the docs and haven't been able to e up with much
here's a part of my code
RENDERER JS FILE
var remote = require('electron').remote;
const ipcRenderer = require('electron').ipcRenderer;
const session = remote.require('electron').session; //i'm trying to use the session module here
var app = remote.require('electron').app; //and here too
MAIN JS PROCESS
const {app} = require('electron')
var fs = require('fs');
const {ipcMain} = require('electron')
const {BrowserWindow} = require('electron')
const {session} = require('electron')
const {dialog} = require('electron')
I recently upgraded to electron v1.3 from 0.37 and get Cannot find module 'remote' in the renderer process.
Been bing through the docs and haven't been able to e up with much
here's a part of my code
RENDERER JS FILE
var remote = require('electron').remote;
const ipcRenderer = require('electron').ipcRenderer;
const session = remote.require('electron').session; //i'm trying to use the session module here
var app = remote.require('electron').app; //and here too
MAIN JS PROCESS
const {app} = require('electron')
var fs = require('fs');
const {ipcMain} = require('electron')
const {BrowserWindow} = require('electron')
const {session} = require('electron')
const {dialog} = require('electron')
Share
Improve this question
asked Sep 13, 2016 at 11:16
d.bayod.bayo
1644 silver badges14 bronze badges
1
- can you past the stack trace error. – MaximeF Commented Sep 13, 2016 at 15:35
2 Answers
Reset to default 4Try with this code
const app = require('electron').remote.app
And in your Main process you can do this :
const {app, ipcMain, BrowserWindow, session, dialog} = require('electron')
var fs = require('fs');
On your renderer process you can invoke your variables like this:
var remote = require('electron').remote;
var session = require('electron).remote.session;
var app = require('electron').app;
/*if the above line doesn't work try this*/
var app = require('electron').remote.app;
var ipcRenderer = require('electron').ipcRenderer;
And in your main.js can use this
const {ipcMain, dialog, session, app, BrowserWindow} = require('electron');
var fs = require('fs');
本文标签: javascriptelectron Cant find module remote in the renderer processStack Overflow
版权声明:本文标题:javascript - electron Cant find module remote in the renderer process - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742059194a2418478.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论