fix: bundle every package's JS output instead of emitting raw tsc - #42
Merged
Merged
Conversation
Every published package except rest and sdk built with bare `tsc` against a tsconfig set to "moduleResolution": "bundler" -- a setting that deliberately emits extension-less relative import specifiers (e.g. `from './resources/checkout'`) on the assumption a bundler runs afterward. None did. Under real Node.js ESM resolution (what every actual npm/Node consumer uses, not Bun's more lenient resolver, which is why local workspace testing never caught this) that produces ERR_MODULE_NOT_FOUND on import, immediately. Confirmed by packing and installing the real tarballs in an isolated directory: types, zod, and typebox all failed on their own internal multi-file imports; adapters failed transitively (imports zod at runtime, not just for types); express/fastify/hono/elysia/supabase all failed transitively through adapters. eslint-plugin and better-auth failed too. Only rest and sdk worked, because they already bundled with `bun build` instead of plain `tsc`. Fix, applied uniformly: `bun build <entrypoints> --outdir dist --target node` for JS (matching each package's actual `exports` map, including the v1/v2 subpaths on types/zod/typebox/sdk that were being silently promised but never produced), then `tsc --emitDeclarationOnly` for types only -- the same pattern rest/sdk already used successfully. Also fixed sdk's build, which only ever bundled the root entrypoint despite declaring `/v1` and `/v2` subpath exports (so `@abacatepay/sdk/v1` has never actually resolved under Node, even before this rewrite). Also fixed eslint-plugin's build/types scripts, which had swapped bodies -- `types` called `bun run types` recursively (infinite loop) and was never invoked by `prepublishOnly` anyway. Verified with `npm pack` + a fresh isolated install of all 11 tarballs together (not the workspace symlinks), running an end-to-end script that imports every package, hits the real API, and exercises the zod -> adapters -> express dispatch chain. All pass. Patch-bumped every affected package (types 3.0.1, sdk/zod/typebox/adapters/ express/fastify/hono/elysia/supabase 2.0.1, eslint-plugin 0.1.3, better-auth 1.0.1) -- this restores intended behavior, no public API changed. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EqaJ2TCZoyMCFjK4WcKxBR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every published package except rest and sdk built with bare
tscagainst a tsconfig set to "moduleResolution": "bundler" -- a setting that deliberately emits extension-less relative import specifiers (e.g.from './resources/checkout') on the assumption a bundler runs afterward. None did. Under real Node.js ESM resolution (what every actual npm/Node consumer uses, not Bun's more lenient resolver, which is why local workspace testing never caught this) that produces ERR_MODULE_NOT_FOUND on import, immediately.Confirmed by packing and installing the real tarballs in an isolated directory: types, zod, and typebox all failed on their own internal multi-file imports; adapters failed transitively (imports zod at runtime, not just for types); express/fastify/hono/elysia/supabase all failed transitively through adapters. eslint-plugin and better-auth failed too. Only rest and sdk worked, because they already bundled with
bun buildinstead of plaintsc.Fix, applied uniformly:
bun build <entrypoints> --outdir dist --target nodefor JS (matching each package's actualexportsmap, including the v1/v2 subpaths on types/zod/typebox/sdk that were being silently promised but never produced), thentsc --emitDeclarationOnlyfor types only -- the same pattern rest/sdk already used successfully. Also fixed sdk's build, which only ever bundled the root entrypoint despite declaring/v1and/v2subpath exports (so@abacatepay/sdk/v1has never actually resolved under Node, even before this rewrite). Also fixed eslint-plugin's build/types scripts, which had swapped bodies --typescalledbun run typesrecursively (infinite loop) and was never invoked byprepublishOnlyanyway.Verified with
npm pack+ a fresh isolated install of all 11 tarballs together (not the workspace symlinks), running an end-to-end script that imports every package, hits the real API, and exercises the zod -> adapters -> express dispatch chain. All pass.Patch-bumped every affected package (types 3.0.1, sdk/zod/typebox/adapters/ express/fastify/hono/elysia/supabase 2.0.1, eslint-plugin 0.1.3, better-auth 1.0.1) -- this restores intended behavior, no public API changed.
Related Issue
Closes (N/A)
Why
What problem does this solve?
What changed
Breaking changes
Checklist
Additional context
Add any other context or screenshots here.