electron / electron/forge

[MacOS] Notifications not working in packaged app when using FusesPlugin

Open
#3,896 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Pre-flight checklist

- [x] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [x] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [x] I have searched the issue tracker for a bug that matches the one I want to file, without success.

### Forge version

7.7.0

### Electron version

35.0.2

### Operating system

macOS 15.3.2

### Last known working Forge version

_No response_

### Expected behavior

Notifications should work both in development mode and in the packaged application.

### Actual behavior

In development mode (electron-forge start), notifications work as expected on macOS.

After packaging the application using electron-forge package, notifications no longer appear.

Removing FusesPlugin from the Forge configuration restores notifications in the packaged app.

### Steps to reproduce

Create a minimal Electron Forge project:

```
npx electron-forge@latest init test-app --template=typescript-webpack
cd test-app
npm install
```

Add a simple notification in src/main.ts:

```
const createWindow = () => {

// Function to show a notification
const showNotification = () => {
const notification = new Notification({
title: 'Hello World',
body: ''
});
notification.show();
};

// Import the Notification module

// Show notification after the window is created
setTimeout(() => {
if (Notification.isSupported()) {
showNotification();
}
}, 2000);
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
},
});

// and load the index.html of the app.
if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {
mainWindow.loadURL(MAIN_WINDOW_VITE_DEV_SERVER_URL);
} else {
mainWindow.loadFile(path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`));
}

// Open the DevTools.
mainWindow.webContents.openDevTools();
};
```

Run the application in dev mode:

`yarn start
`
Notifications appear correctly.

Package the application:

`yarn make
`
Open the packaged app:

Notifications do not appear.

Remove FusesPlugin from forge.config.ts, repackage, and pack again:

Notifications work again.

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.