Trying to build an app with Electron + Angular 2 (and Angular CLI). I actually create the project, install Electron and setup the basic app and all works perfectly, but I lately tried to use the file system Node module in a TS class and once I start Electron it says in devtools:

Uncaught TypeError: fs.existsSync is not a function
at Object.<anonymous> (vendor.bundle.js:6793)
at Object.../../../../electron/index.js (vendor.bundle.js:6799)
at __webpack_require__ (inline.bundle.js:55)
at Object.../../../../../src/app/utils/ConfigurationUtils.ts (main.bundle.js:399)
at __webpack_require__ (inline.bundle.js:55)
at Object.../../../../../src/app/AppComponent.ts (main.bundle.js:21)
at __webpack_require__ (inline.bundle.js:55)
at Object.../../../../../src/app/AppModule.ts (main.bundle.js:71)
at __webpack_require__ (inline.bundle.js:55)
at Object.../../../../../src/main.ts (main.bundle.js:457)

How can I make it work? I’m pretty new to the Node scene, so… can someone of you explain what’s going on? Thanks…

So… do someone have a solution? Reading around it seems like the problem is caused by webpack and the fact that it uses its own require implementation, but being new into Node/TS development doesn’t exactly help, so I don’t know what to do.