Problem
packages/*/tsconfig.tsbuildinfo (TypeScript's incremental build cache) was committed to git for all four packages (core, nestjs, express, fastify), while dist/ itself is gitignored.
That combination broke tsc -b's incremental logic: on a fresh checkout, dist/ doesn't exist, but the stale committed buildinfo told TypeScript "these outputs are already up to date relative to the sources," so tsc -b silently skipped re-emitting some of them.
Concretely, reqlog-core's published tarball (verified for 0.1.0 and 0.2.0) was missing dist/index.js and other CJS files that its own package.json main/exports.require point to. Any CommonJS consumer (e.g. a NestJS app built with default nest build, which targets CommonJS) failed at runtime with Error: Cannot find module '.../reqlog-core/dist/index.js' / MODULE_NOT_FOUND — even though tsc reported 0 compile errors. It's a silent partial-emit bug, not a type error.
Fix
- Untracked
tsconfig.tsbuildinfofrom git in all four packages and added*.tsbuildinfoto.gitignore. - Updated each package's
cleanscript to also remove*.tsbuildinfo, not justdist/, soprepackalways starts from a truly clean state before publish. - Found and fixed a related leak:
tsc -p tsconfig.esm.jsonwas emitting its buildinfo insidedist/(dist/tsconfig.esm.tsbuildinfo). Sincepackages/core/package.jsonwhitelistsdistviafiles, that stray file was slipping into the published tarball regardless of.gitignore/.npmignore. Added an explicittsBuildInfoFileto eachtsconfig.esm.jsonso it's written outsidedist/instead.
Verification
- Clean rebuild of
reqlog-coreemits the complete CJS set:dist/index.js,dist/index.d.ts,dist/ring-buffer.js,dist/sse-manager.js,dist/static-handler.js,dist/utils.js. npm pack --dry-runinpackages/corelists the full CJS + ESM set, with no.tsbuildinfoin the tarball.reqlog-nestjsbuilds cleanly (previously failed withTS7016: Could not find a declaration file for module 'reqlog-core').require()against the packed tarballs resolvesReqlogServer,RingBuffer,createInterceptor(core), and the express/fastify middleware, in all cases correctly loadingreqlog-coreas a real dependency.- Full monorepo
bun run buildandbun run test(35 tests) pass from a clean state.
Test plan
-
rm -rf packages/*/dist packages/*/tsconfig*.tsbuildinfo && bun run buildsucceeds -
cd packages/core && npm pack --dry-runlistsdist/index.jsand no.tsbuildinfo -
bun run testpasses
Heads up for reviewers:
examples/nestjs-examplestill fails today, even with this fix applied to the repo — it installsreqlog-core/reqlog-nestjsfrom the npm registry (not the local workspace), and the currently published0.2.0has the exact broken CJS build this PR fixes. It'll keep failing withMODULE_NOT_FOUNDonreqlog-core/dist/index.jsuntil a new version is published to npm. There's also a separate, unrelated issue where the example is missing thestart:devscript thatCONTRIBUTING.mdtells contributors to run.Filed both as #4 so they don't get lost — not blocking this PR, just flagging so the example gets re-verified after the next npm release.