Angular-electron desktop app, not able find module 'ws' after packaging and trying to run .exe file

14 Views Asked by At

I have angular-electron app with following details:

node version: 20.10.0
electron version: 27.2.0
angular cli version: 17.0.8
electron-builder version: 24.9.1
ws version: 8.16.0

I have main.ts (electron) file inside app/main.ts.

Inside this I am using 'ws'.

It runs perfectly well in electron.

But when I try to package my project and generate dist folder, the generated .exe file does not run and says "cannot find module 'ws'".

If I remove 'ws' import form main.ts file then the .exe runs perfectly well.

I am not able to find where I am going wrong...

I tried to include "/node_modules/ws/**/*" inside electron-builder.json in files configuration and tried solutions online, but nothing worked for me.

0

There are 0 best solutions below