Electron require() is not defined

I’m creating an Electron app for my own purpose. My problem is when I’m using node functions inside my HTML page it throws an error of:

‘require()’ is not defined.

Is there any way to use Node functionalities in all my HTML pages? If it is possible please give me an example of how to do this or provide a link. Here are the variables I’m trying to use in my HTML page:

  var app = require('electron').remote; 
  var dialog = app.dialog;
  var fs = require('fs');

and these are the values I’m using in all my HTML windows within Electron.

10 Answers
10

Leave a Comment