From e2f1e89cb86e48471ff21151bda46ce40b4dc273 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 27 May 2026 12:28:40 -0700 Subject: [PATCH] [eric] build: import the notarize esm module lazily so electron-builder stops choking on every non-mac build --- electron/scripts/notarize.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/electron/scripts/notarize.js b/electron/scripts/notarize.js index 76bf1c05..d0a6e7c2 100644 --- a/electron/scripts/notarize.js +++ b/electron/scripts/notarize.js @@ -1,5 +1,8 @@ -const { notarize } = require('@electron/notarize'); - +// @electron/notarize 3.x is ESM-only, so a top-level require() throws +// ERR_REQUIRE_ESM the moment electron-builder loads this afterSign hook — which +// it does for EVERY platform/build, breaking even unsigned Windows packaging. +// Import it lazily, after the skip checks, so it's only loaded when we actually +// notarize (signed macOS). Dynamic import() works from CommonJS. exports.default = async function notarizing(context) { const { electronPlatformName, appOutDir } = context; if (electronPlatformName !== 'darwin') return; @@ -14,6 +17,8 @@ exports.default = async function notarizing(context) { return; } + const { notarize } = await import('@electron/notarize'); + const appName = context.packager.appInfo.productFilename; const appPath = `${appOutDir}/${appName}.app`;