Fall back to a resolved @get-bb/plugin-sdk entry for the legacy SDK alias in source dev mode - #2335
Open
technicalpickles wants to merge 1 commit into
Open
Conversation
…lias in source dev mode The legacy @bb/plugin-sdk alias only got registered when a prebuilt dist/plugin-sdk-runtime.js existed next to plugin-runtime.ts. That file is produced only by the server's build script, so pnpm dev and pnpm dev:desktop (which run the server from src/ via tsx) never had it, silently leaving the legacy specifier unaliased. Any installed plugin still importing the pre-rename @bb/plugin-sdk specifier then failed to load with "Cannot find module '@bb/plugin-sdk'" in every source dev workflow, even though the same plugin loads fine in a packaged build. Fixes get-bb#2334 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015qxKRmfvW9v9jTuC1UK58K
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.
What was wrong
pluginSdkAliasinapps/server/src/services/plugins/plugin-runtime.tsonly registered the legacy@bb/plugin-sdkspecifier alias (kept since the #1574 rename to@get-bb/plugin-sdk) when a prebuiltdist/plugin-sdk-runtime.jsbundle existed next to the running module. That bundle is produced only by the server'sbuildscript.pnpm devandpnpm dev:desktoprun the server fromsrc/viatsxand never runbuild, sopluginSdkAliassilently resolved toundefinedin every source dev workflow. Any installed plugin still importing the pre-rename@bb/plugin-sdkspecifier (e.g.bb-plugin-dispatch@0.1.3) then failed to load withCannot find module '@bb/plugin-sdk', even though the same plugin loads fine in a packaged/production build (nightly,npx bb-app). See #2334 for the full repro and log evidence.What changed
apps/server/src/services/plugins/plugin-runtime.ts: extractedresolvePluginSdkAliasTarget(). When the prebuilt runtime bundle is missing, it falls back toimport.meta.resolve("@get-bb/plugin-sdk")(the package already resolves naturally in source dev mode per the existing doc comment) and aliases the legacy specifier to that resolved path instead of leaving it unaliased.apps/server/test/services/plugins/plugin-sdk-alias.test.ts: added a test asserting the fallback resolves to the plugin-sdk source entry when no prebuilt bundle is present (this is how the suite always runs, so it exercises the exact dev-mode gap).No wire/protocol changes, no CLI/doc surface changes — this only affects how the server resolves an internal module alias during plugin loading.
How you verified
pnpm exec turbo run typecheck --filter=@bb/server— passes.pnpm exec turbo run test --filter=@bb/server -- --run test/services/plugins/plugin-sdk-alias.test.ts— both tests pass (the new one fails without the fix, sinceresolvePluginSdkAliasTarget()would returnundefined).pnpm dev:desktopbefore the fix and confirmedbb-plugin-dispatch@0.1.3failed withCannot find module '@bb/plugin-sdk'in the server log and showed "Failed" in the Extensions UI. Applied the fix, restartedpnpm dev:desktop, confirmed the same plugin now loads (plugin dispatch@0.1.3 loadedin the log) and shows healthy/enabled in the Extensions UI with no error banner.main(not just the branch where I found the bug), so this isn't an artifact of leftover state.Fixes #2334