Skip to content

Commit b3c7682

Browse files
dshoen619claude
andcommitted
fix(build): shrink published package from ~202 MB to ~3.5 MB (PER-15197)
v2.7.5's hybrid tsup build shipped the entire per-file build/ tree — every internal module bundled with the OpenAPI client inlined, in both CJS and ESM, plus a .map for every file (708 maps, 77 MB) and the test specs. Result: ~202 MB published, breaking AWS Lambda's code-size limit. The published artifact only needs the self-contained build/index.js / build/index.mjs bundles (0 relative imports; axios/lodash/pino/url-parse externalized) plus type declarations. The per-file outputs exist solely so the test suite can import internal modules by relative path, so they must keep being built — but they don't need to be published. - package.json files: publish only build/index.{js,mjs} + build/**/*.d.ts (exclude per-file JS, all maps, and tests) instead of the whole build/ - tsup.config.ts: sourcemap false (maps are unused by tests, never shipped) Verified via npm pack: 202 MB -> 3.5 MB unpacked (195 KB packed), 0 maps, 0 test files. CJS + ESM consume tests pass; module-import suite passes 6/6. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ee5f42e commit b3c7682

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,10 @@
100100
"typescript": "^4.6.4"
101101
},
102102
"files": [
103-
"build",
104-
"!**/*.spec.*",
105-
"!**/*.json",
103+
"build/**/*.d.ts",
104+
"build/index.js",
105+
"build/index.mjs",
106+
"!build/tests/**",
106107
"CHANGELOG.md",
107108
"LICENSE",
108109
"README.md"

tsup.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ export default defineConfig({
55
format: ['cjs', 'esm'],
66
dts: false,
77
splitting: false,
8-
sourcemap: true,
8+
// Source maps are intentionally not emitted: they are not used by the test
9+
// suite and previously shipped ~77 MB of .map files in the published package
10+
// (see PER-15197). The published artifact is the self-contained build/index.*
11+
// bundle only; per-file outputs below exist solely so the test suite can
12+
// import internal modules by relative path.
13+
sourcemap: false,
914
clean: true,
1015
outDir: 'build',
1116
target: 'node16',

0 commit comments

Comments
 (0)