Commit b3c7682
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
105 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
9 | 14 | | |
10 | 15 | | |
11 | 16 | | |
| |||
0 commit comments