I am attempting to make my first Electron app using Angular 18. I have followed a couple of tutorials closely, but I keep getting an error message when building the app. I created a basic service to handle the IPC functionality that lets the angular UI talk to the Electron functionality.
import { Injectable } from '@angular/core';
import {IpcRenderer} from 'electron';
@Injectable({
providedIn: 'root'
})
export class IpcService {
private ipc: IpcRenderer | undefined;
constructor() {
try {
this.ipc = window.require('electron').ipcRenderer;
} catch (e) {
throw e;
}
}
test(): void {
this.ipc?.send("openModal")
}
}
the line this.ipc = window.require('electron').ipcRenderer; seems to be causing this error on build: "An unhandled exception occurred: Cannot destructure property 'routes' of '(intermediate value)' as it is undefined."
When I remove that line, the app builds and loads normally, except of course the IPC won't work. I've can't seem to find anyone else having this issue so I feel like there's something obvious I'm missing. Thanks for the help!