diff --git a/packages/desktop/electron-builder.config.test.ts b/packages/desktop/electron-builder.config.test.ts index 6e773dd1d58..256a3bb2a3c 100644 --- a/packages/desktop/electron-builder.config.test.ts +++ b/packages/desktop/electron-builder.config.test.ts @@ -91,6 +91,11 @@ for (const channel of channels) { "js-yaml/dist/js-yaml.min.js", "js-yaml/dist/js-yaml.mjs.map", "js-yaml/bin/js-yaml.js", + "unrelated/dist/index.js.map", + "unrelated/dist/index.cjs.map", + "unrelated/dist/index.d.ts", + "unrelated/dist/index.d.cts", + "unrelated/dist/index.d.ts.map", ]) { expect(filter(path.join(import.meta.dirname, prefix, file), statSync(import.meta.filename))).toBe(false) } @@ -112,7 +117,10 @@ for (const channel of channels) { "js-yaml/lib/loader.js", "js-yaml/dist/js-yaml.mjs", "debug/src/index.js", - "unrelated/dist/index.js.map", + "unrelated/dist/index.js", + "unrelated/dist/index.cjs", + "unrelated/dist/data.json", + "unrelated/src/index.ts", ...["@zip.js/zip.js", "electron-updater", "builder-util-runtime", "ajv", "ajv-formats", "js-yaml"].flatMap( (name) => [`${name}/package.json`, `${name}/LICENSE`], ), diff --git a/packages/desktop/electron-builder.config.ts b/packages/desktop/electron-builder.config.ts index 6830c8a9c18..3188999bacc 100644 --- a/packages/desktop/electron-builder.config.ts +++ b/packages/desktop/electron-builder.config.ts @@ -77,11 +77,14 @@ const getBase = (appId: string): Configuration => ({ // Log export imports Zip.js as ESM. Keep index.js and lib, including its inline worker. "!**/node_modules/@zip.js/zip.js/dist{,/**/*}", "!**/node_modules/@zip.js/zip.js/{index.cjs,index.min.js,index-fflate.js,deno.json,eslint.config.mjs}", - // These packages execute compiled JavaScript, not their sources or source maps. - "!**/node_modules/{electron-updater,builder-util-runtime,lazy-val}/out/**/*.js.map", + // Nothing executes type declarations or source maps, and every entry costs startup time: the + // main process parses the whole asar header before it runs any JavaScript. + "!**/node_modules/**/*.d.{ts,cts,mts}", + "!**/node_modules/**/*.d.{ts,cts,mts}.map", + "!**/node_modules/**/*.{js,cjs,mjs}.map", + // These packages execute compiled JavaScript, not their sources. "!**/node_modules/ajv/lib{,/**/*}", "!**/node_modules/ajv-formats/src{,/**/*}", - "!**/node_modules/{ajv,ajv-formats}/dist/**/*.js.map", // Keep js-yaml's CommonJS sources and dist/js-yaml.mjs ESM entry, not browser bundles or its CLI. "!**/node_modules/js-yaml/dist/{js-yaml.js,js-yaml.min.js,*.map}", "!**/node_modules/js-yaml/bin{,/**/*}",