I make a project in electronJS with whatsapp-web.js. When i debug with npm start it works properly. but when I build with electron and install the (.exe) file the project don't works. It seems the Puppeteer not running. How can I solve the problem? NB: I am using electron-builder for build the application for Windows.
{
"name": "testapp",
"version": "1.0.0",
"description": "testapp",
"main": "main.js",
"scripts": {
"start": "electron .",
"build": "electron-builder"
},
"build": {
"appId": "com.testapp.test",
"productName": "testapp",
"target": "NSIS",
"nsis" : {
"oneClick" : true,
"allowToChangeInstallationDirectory" : false
}
},
"author": "Udayan Basak",
"license": "ISC",
"devDependencies": {
"electron": "^15.3.1",
"electron-builder": "^22.14.5"
},
"dependencies": {
"whatsapp-web.js": "^1.15.2"
}
}
This is my package.json data. [Again: full project working fine in development mode. It causes error in production lavel.]
const { Client } = require('whatsapp-web.js');
const {app, BrowserWindow, ipcMain, ipcRenderer } = require('electron')
const client = new Client();
client.on('qr', (qr) => {
win.webContents.send("qrcode", qr)
});
client.on('ready', () => {
win.webContents.send("ready", "ready")
})
Can you share your webpack config? Maybe adding the following can help:
optimization: { minimize: false }