2
respostas

Erro ao instanciar ipcRenderer

Estou tendo problemas na declaração do ipcRenderer, apresentar error :

main.css:1 Failed to load resource: net::ERR_FILE_NOT_FOUND
renderer.js:1 Uncaught ReferenceError: require is not defined
    at renderer.js:1
C:\Users\Guilherme\Documents\Projetos\XMLValidate\node_modules\electron-nightly\dist\resources\electron.asar\renderer\security-warnings.js:147 Electron Security Warning (Insecure Content-Security-Policy) This renderer process has either no Content Security
    Policy set or a policy with "unsafe-eval" enabled. This exposes users of
    this app to unnecessary security risks.

For more information and help, consult
https://electronjs.org/docs/tutorial/security.
 This warning will not show up
once the app is packaged.
(anonymous) @ C:\Users\Guilherme\Documents\Projetos\XMLValidate\node_modules\electron-nightly\dist\resources\electron.asar\renderer\security-warnings.js:147

o código esta assim:

const  ipcRenderer = require('electron').ipcRenderer;

let btnUP = document.getElementById('btn-up');
btnUP.addEventListener('click', function() {
    ipcRenderer.send('abrir-janela-up');
});
2 respostas

alguém?

Oi Guilherme, estranho ele reclamar do seu require(). Como você tá fazendo pra executar? Pode me disponibilizar seu projeto no GitHub pra mim testar mais de perto?