I have an electron project when I need to get electron to read a local file.
Right now what I have is this, where it loads and displays the contents of a html file.<
Just one update information for the accepted answer. After the update of electron, you can directly use
const { dialog } = require('electron');
to import dialog.
And for remote, if you need to use it, you also need:
const { remote } = require('electron');