forge icon indicating copy to clipboard operation
forge copied to clipboard

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

Open Maxime-JULLIEN opened this issue 9 months ago • 2 comments

Pre-flight checklist

  • [x] I have read the contribution documentation for this project.
  • [x] I agree to follow the code of conduct 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

Maxime-JULLIEN avatar Mar 19 '25 08:03 Maxime-JULLIEN

Thanks for reporting! I'm not sure if this is a Forge issue. I'd personally file it in the main Electron repository.

However, before you open an issue there, please check if signing and notarizing the app solves your problem.

nikwen avatar Mar 23 '25 20:03 nikwen

Facing the same issue. @Maxime-JULLIEN please share if you found a solution?

felipap avatar Mar 30 '25 08:03 felipap