Calling ipcRenderer from inside an angular2 application


Hi. I have an angularjs running on top of electron, using TypScript. I want to send a simple message from the renderer process (Only one window) to the Main process using ipcRenderer.send().

The code is simple:

import { Component } from '@angular/core';
import { ipcRenderer } from 'electron';

    selector: 'login-form',
    templateUrl: 'login-form.html'

export class AppComponent {
        // call the main process ... ??

TypeScript compiler doesn’t like it and fails with:

frontend/component.ts(2,29): error TS2307: Cannot find module 'electron'.

Anyone has run into this before?


When you launch the browser window, you need to turn nose-integration = true for electron module to be available. You angular will also be using common is as module load framework. I don’t think commonjs can be used with angular. You can turn off the node integration by setting it to false and export the ipcRenderer in preload script on Windows object in order to communicate with main process.