perf(desktop): leave declarations and source maps out of the asar (#49772)

This commit is contained in:
Luke Parker
2026-09-19 10:33:48 +10:00
committed by GitHub
Unverified
parent 5b565e8923
commit e755fce13d
2 changed files with 15 additions and 4 deletions
@@ -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`],
),
+6 -3
View File
@@ -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{,/**/*}",