After updating node-fetch
to v3, the following JavaScript error message appears when trying to launch my Electron app:
Uncaught Exception: Error [ERR_REQUIRE_ESM]: require() of ES Module (...) not supported. Instead change the required ... to a dynamic import() ...
I have found here that I should replace
const fs = require('fs');
with:
import fs from "fs";
But how to replace in the same fashion the following?
// Modules to control application life and create native browser window
const {
app,
session,
BrowserWindow
} = require('electron');