Skip to content

Ship pre-compiled JS to avoid transpilation cost#27

Open
JosXa wants to merge 1 commit intoshekohex:mainfrom
JosXa:feat/ship-compiled-js
Open

Ship pre-compiled JS to avoid transpilation cost#27
JosXa wants to merge 1 commit intoshekohex:mainfrom
JosXa:feat/ship-compiled-js

Conversation

@JosXa
Copy link

@JosXa JosXa commented Mar 10, 2026

Summary

  • Ship pre-compiled JS in the npm package so consumers don't pay Bun transpilation cost on every load
  • Follows the same pattern as opencode-snippets: tsc -p tsconfig.build.json emits to dist/, npm package ships only dist/
  • Fix import.meta.dir path resolution for static file serving when running from dist/

Changes

  • tsconfig.build.json — build config targeting dist/, with rewriteRelativeImportExtensions for Bun-style .ts imports
  • package.jsonmain/types/module point to dist/, new build:plugin script, prepublishOnly hook, files: ["dist"]
  • src/web/server/handlers/static.ts — strip trailing /dist from resolved module dir so static assets resolve correctly from both source and compiled output

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant