fix: create dev shims in gateway build so workspace consumers resolve bun exports#425
Merged
Conversation
… bun exports PR #415 changed the gateway's "bun" export from ./src/index.ts to ./dist/index.bun.js, but that file only exists after `bun run bundle`. The `prepare` script added to create a dev shim never ran because Bun does not execute lifecycle scripts for workspace packages. - Make buildLibrary() in build.ts create lightweight dev shims that re-export from source (export * from "../src/index.ts") - Add root postinstall to run gateway build after `bun install` - Remove the broken prepare script from gateway package.json - Update bundle-exports test skip condition to detect dev shims
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
Fixes the lore startup failure in OpenCode caused by PR #415 —
Cannot find module '@loreai/gateway'.PR #415 changed the gateway's
"bun"export condition from./src/index.ts(always present) to./dist/index.bun.js(requiresbun run bundle). Apreparescript was added to create a dev shim, but Bun does not execute lifecycle scripts for workspace packages, so the file was never created.Changes
packages/gateway/script/build.ts: Replace the no-opbuildLibrary()with a function that creates lightweight dev shims (export * from "../src/index.ts") fordist/index.bun.jsanddist/embedding-worker.js. Skips overwriting real bundle output by content-checking existing files.packages/gateway/package.json: Remove the brokenpreparescript (never ran for workspace packages).package.json(root): Addpostinstallscript that runsbun --filter '@loreai/gateway' buildsobun installalone creates the dev shims.packages/gateway/test/bundle-exports.test.ts: Update skip condition to detect dev shims vs real bundles so content-checking tests correctly skip in dev.How it works
bun run build(workspace-wide) now creates dev shims for gateway's"bun"exportsbun run bundle(production) still wipesdist/first and creates real artifacts — shims never interferepostinstallensures fresh clones +bun installhave working exports immediately.gitignorealready excludesdist/, so shims aren't committed