DEV Community

Discussion on: Integrating an Angular-CLI application with Electron - The seed

Collapse
 
ruipimentel profile image
ruipimentel

Hi Michael, thank you for your guide.

Probably, however, in your tutorial Angular may only be able to use standard browser APIs. Electron, as you surely know, relies on a "special" version of Chromium which has access to a lot of other APIs.

That said, to allow an Angular app to access Electron's "superpowers" (like Tray Menu, Global Shortcuts and so on), it would be necessary to compile it along with "@types/electron" ("npm install --save-dev @types/electron", then "import { some electron lib } from 'electron';"). Unfortunately, @angular/cli messes around with "require()" during compilation, due to it's internal webpack "target" config not being set to "electron-renderer".

How to set up @angular/cli to compile accordingly? Thanks in advance!

Collapse
 
michaeljota profile image
Michael De Abreu

Hi @ruipimentel . I'm glad you'd found it helpful. I'm just writing another post about calling functions in Electron main thread using ipc in Angular. When I have it ready, I'll update this with the link. Thanks.