Changelog - 2026-07-17
Secrets Peers Invisible to Bundlers
Bug Fix Behavior ChangeIn one line. Compiling an application with Bun.build no longer fails on the optional secrets peers - external: ['node-vault'] workarounds can be removed.
What changed
Bun.buildno longer resolves the secrets peers at bundle time. The literal dynamic imports ofnode-vaultand@dotenvx/dotenvxwere visible to the bundler, so every application compiling a binary failed to resolve them unless the peer was installed or listed inexternal. Both imports now cross theimportOptionalModulefunction boundary, which the bundler cannot fold into a resolvable literal - not even underminify: { syntax: true }.- A missing peer now fails with the standard install hint. Constructing
HashiCorpVaultHelperorDotenvVaultHelperdirectly (via the/hashicorp-vaultand/dotenv-vaultsub-paths) without the peer installed used to reject with a raw module-not-found error; it now throws the same actionableApplicationError(Please install 'node-vault') as the factory path. - The peer is no longer embedded into compiled binaries. Previously, referencing a vault provider with the peer installed caused
Bun.buildto bundle it. A compiled application that uses a provider must now ship the peer innode_modulesnext to the binary, or inject a ready-madeclient(HashiCorp) /decode(dotenv) through the helper options.
Who is affected
- Applications that compile binaries and do not use a vault provider. Fixed for free - remove any
external: ['node-vault']entry from yourBun.buildcalls after upgrading. - Applications that compile binaries and do use a vault provider. Action needed: ship the peer in
node_modulesnext to the binary, or inject the client through the helper options. - Applications that do not compile binaries. No action needed - runtime behavior is unchanged.