You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can bun zero-install (no node_modules, no bun install) get lockfile-like reproducible versions? Specifically: if we generate a bun.lock fast via bun install --lockfile-only and commit it, does bun's RUNTIME auto-install honor that lock and resolve BARE imports to the locked versions? If yes, the entire webjs pin shim (#685/#698/#699/#700/#703/#704/#709) could be deleted and the scaffold would just commit a bun.lock.
Verdict (bun 1.3.14): NO
A committed bun.lock does NOT make bun's runtime auto-install resolve bare imports. The pin shim stays. bun.lock is not a viable replacement for the zero-install default.
Empirically:
bun install --lockfile-only works as advertised: generates bun.lock in ~220ms, writes NO node_modules. So the FAST lock generation half of the other-agent claim is TRUE.
But the RUNTIME half is FALSE. With bun.lock pinning lodash@4.17.20, that version cached, and NO node_modules, a bare import('lodash') ENOENTs (error: ENOENT while resolving package 'lodash'), identically with or without the lock, via both bun run x.mjs and bun x.mjs. The lock is simply not consulted for bare-import resolution.
Positive control: in the SAME dir, an INLINE import('lodash@4.17.20') resolves to 4.17.20 from cache. So the cache is fine and inline specifiers resolve reliably. Inline is exactly what the pin shim produces.
Bare imports are also inconsistent (a cached cowsay@1.6.0, which is also latest, loaded bare; lodash@4.17.20 with latest 4.17.21 did not), matching bun's own source comment that auto-install "always installs the latest version regardless of package.json". When a bare import resolves at all it targets latest, never the locked/declared version when they differ.
bun.lock as an opt-in reproducibility tier is ALSO not useful today: bun's runtime ignores it for bare resolution, so committing it buys nothing at runtime on 1.3.14. (It may help editor tooling or a future bun.)
Question
Can bun zero-install (no
node_modules, nobun install) get lockfile-like reproducible versions? Specifically: if we generate abun.lockfast viabun install --lockfile-onlyand commit it, does bun's RUNTIME auto-install honor that lock and resolve BARE imports to the locked versions? If yes, the entire webjs pin shim (#685/#698/#699/#700/#703/#704/#709) could be deleted and the scaffold would just commit abun.lock.Verdict (bun 1.3.14): NO
A committed
bun.lockdoes NOT make bun's runtime auto-install resolve bare imports. The pin shim stays.bun.lockis not a viable replacement for the zero-install default.Empirically:
bun install --lockfile-onlyworks as advertised: generatesbun.lockin ~220ms, writes NOnode_modules. So the FAST lock generation half of the other-agent claim is TRUE.bun.lockpinninglodash@4.17.20, that version cached, and NOnode_modules, a bareimport('lodash')ENOENTs (error: ENOENT while resolving package 'lodash'), identically with or without the lock, via bothbun run x.mjsandbun x.mjs. The lock is simply not consulted for bare-import resolution.import('lodash@4.17.20')resolves to 4.17.20 from cache. So the cache is fine and inline specifiers resolve reliably. Inline is exactly what the pin shim produces.cowsay@1.6.0, which is also latest, loaded bare;lodash@4.17.20with latest4.17.21did not), matching bun's own source comment that auto-install "always installs the latest version regardless of package.json". When a bare import resolves at all it targets latest, never the locked/declared version when they differ.Implication
bun.lockpath cannot delete the pin shim. The shim (rewrite bare specifier to inline-versioned) is the ONLY reliable mechanism, because inline specifiers resolve where bare ones ENOENT. This REINFORCES docs: make the bun auto-install pin shim self-documenting + deletable #714 (document the shim) and harden the bun auto-install pin shim (fail-open, capability probe, escape hatch, CI canary) #715 (harden it).bun.lockas an opt-in reproducibility tier is ALSO not useful today: bun's runtime ignores it for bare resolution, so committing it buys nothing at runtime on 1.3.14. (It may help editor tooling or a future bun.)Verified on bun 1.3.14. Re-test on canary / future releases via the #715 CI-canary job.