feat: precompile workspace packages, remove tsx from production runtime - #10
Merged
Conversation
Switch all workspace package exports from src/*.ts to dist/*.js so the server runs on precompiled JavaScript without needing tsx as a runtime transpiler. Changes: - All package.json exports fields now point to dist/ (previously pointed to src/ for development convenience, with publishConfig overriding for npm publish) - Dockerfile CMD changed from node --import tsx/loader to node directly - Dockerfile now prunes devDependencies (tsx no longer needed at runtime) - Selective dist-only COPY in production stage works correctly now Benefits: - Faster startup (no runtime transpilation) - Smaller image (no tsx, no TypeScript source in production) - No devDependencies shipped - More secure (no source code in production image) - Reproducible (compiled output is deterministic) Verified: server starts and runs correctly with node server/dist/index.js without tsx loader. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
TypeScript resolves types via the "types" condition (pointing to src/*.ts for zero-build typechecking), while Node resolves runtime imports via the "import" condition (pointing to dist/*.js). This lets pnpm -r typecheck work without building first, while the runtime still uses precompiled output. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use Node's --conditions flag to switch between source and compiled output: - "default" → ./src/*.ts (dev, tests, typecheck — no build needed) - "production" → ./dist/*.js (Docker, deployed environments) Dockerfile CMD uses --conditions=production so Node resolves workspace imports to precompiled dist/ output. Dev tools (vitest, tsx, tsc) use the default condition and resolve to source. Verified: typecheck passes, 569 tests pass, server starts with --conditions=production without tsx. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
github-actions Bot
pushed a commit
that referenced
this pull request
Mar 23, 2026
…me (#10) * feat: precompile all workspace packages — eliminate tsx from runtime Switch all workspace package exports from src/*.ts to dist/*.js so the server runs on precompiled JavaScript without needing tsx as a runtime transpiler. Changes: - All package.json exports fields now point to dist/ (previously pointed to src/ for development convenience, with publishConfig overriding for npm publish) - Dockerfile CMD changed from node --import tsx/loader to node directly - Dockerfile now prunes devDependencies (tsx no longer needed at runtime) - Selective dist-only COPY in production stage works correctly now Benefits: - Faster startup (no runtime transpilation) - Smaller image (no tsx, no TypeScript source in production) - No devDependencies shipped - More secure (no source code in production image) - Reproducible (compiled output is deterministic) Verified: server starts and runs correctly with node server/dist/index.js without tsx loader. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use conditional exports — types from src/, import from dist/ TypeScript resolves types via the "types" condition (pointing to src/*.ts for zero-build typechecking), while Node resolves runtime imports via the "import" condition (pointing to dist/*.js). This lets pnpm -r typecheck work without building first, while the runtime still uses precompiled output. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use custom "production" condition for dist/ exports Use Node's --conditions flag to switch between source and compiled output: - "default" → ./src/*.ts (dev, tests, typecheck — no build needed) - "production" → ./dist/*.js (Docker, deployed environments) Dockerfile CMD uses --conditions=production so Node resolves workspace imports to precompiled dist/ output. Dev tools (vitest, tsx, tsc) use the default condition and resolve to source. Verified: typecheck passes, 569 tests pass, server starts with --conditions=production without tsx. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
stubbi
added a commit
that referenced
this pull request
Apr 17, 2026
…me (#10) * feat: precompile all workspace packages — eliminate tsx from runtime Switch all workspace package exports from src/*.ts to dist/*.js so the server runs on precompiled JavaScript without needing tsx as a runtime transpiler. Changes: - All package.json exports fields now point to dist/ (previously pointed to src/ for development convenience, with publishConfig overriding for npm publish) - Dockerfile CMD changed from node --import tsx/loader to node directly - Dockerfile now prunes devDependencies (tsx no longer needed at runtime) - Selective dist-only COPY in production stage works correctly now Benefits: - Faster startup (no runtime transpilation) - Smaller image (no tsx, no TypeScript source in production) - No devDependencies shipped - More secure (no source code in production image) - Reproducible (compiled output is deterministic) Verified: server starts and runs correctly with node server/dist/index.js without tsx loader. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use conditional exports — types from src/, import from dist/ TypeScript resolves types via the "types" condition (pointing to src/*.ts for zero-build typechecking), while Node resolves runtime imports via the "import" condition (pointing to dist/*.js). This lets pnpm -r typecheck work without building first, while the runtime still uses precompiled output. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: use custom "production" condition for dist/ exports Use Node's --conditions flag to switch between source and compiled output: - "default" → ./src/*.ts (dev, tests, typecheck — no build needed) - "production" → ./dist/*.js (Docker, deployed environments) Dockerfile CMD uses --conditions=production so Node resolves workspace imports to precompiled dist/ output. Dev tools (vitest, tsx, tsc) use the default condition and resolve to source. Verified: typecheck passes, 569 tests pass, server starts with --conditions=production without tsx. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Eliminates tsx runtime transpilation from the Docker image. All workspace packages now export precompiled
dist/*.jsinstead of rawsrc/*.ts.What changed
Every workspace package had a dual export pattern:
The
publishConfig.exports(which already pointed todist/) was promoted to the mainexportsfield in all 11 packages.Dockerfile changes
node --import tsx/dist/loader.mjs server/dist/index.js→node server/dist/index.jspnpm prune --prodnow works (tsx was the blocker before)dist/andpackage.jsonper package (no source code)Benefits
Verified locally
No tsx, no errors.
Test plan
pnpm -r buildsucceedsnode server/dist/index.jsstarts without tsx🤖 Generated with Claude Code