Fix JS push bundles externalizing Braintrust SDK - #2477
Open
ekeith (evanmkeith) wants to merge 1 commit into
Open
Fix JS push bundles externalizing Braintrust SDK#2477ekeith (evanmkeith) wants to merge 1 commit into
ekeith (evanmkeith) wants to merge 1 commit into
Conversation
## Summary Fixes the JS SDK CLI push bundle path so uploaded function bundles inline Braintrust SDK packages by default again. The regression came from passing `plugins: []` into `buildOpts()`, which still allowed the built-in known-package externalization plugin to mark `braintrust`, `autoevals`, and `@braintrust/*` external. Hosted function runtime then failed at load time with `Cannot find module 'braintrust'`. This change disables only that known-package externalization plugin for final uploaded bundles, while keeping it enabled for local discovery builds. ## Testing - `cd js && pnpm vitest src/cli/auto-instrumentation.test.ts src/cli/util/external-packages-plugin.test.ts` - `./node_modules/.bin/prettier --write js/src/cli/index.ts js/src/cli/auto-instrumentation.test.ts`
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 JS SDK CLI push bundle path so uploaded function bundles inline Braintrust SDK packages by default again.
The regression came from passing
plugins: []intobuildOpts(), which still allowed the built-in known-package externalization plugin to markbraintrust,autoevals, and@braintrust/*external. Hosted function runtime then failed at load time withCannot find module 'braintrust'.This change disables only that known-package externalization plugin for final uploaded bundles, while keeping it enabled for local discovery builds.
Testing
cd js && pnpm vitest src/cli/auto-instrumentation.test.ts src/cli/util/external-packages-plugin.test.ts./node_modules/.bin/prettier --write js/src/cli/index.ts js/src/cli/auto-instrumentation.test.tsAddresses: https://linear.app/braintrustdata/issue/SDK-357/js-sdk-braintrust-push-externalizes-braintrust-in-uploaded-bundles