Bun.resolveSync — module resolution outside the build context
Bun.resolveSync(specifier, parent) resolves a module specifier to an absolute path using Bun's resolver. Useful outside of Bun.build's native resolution.
Summary
Bun.resolveSync(specifier, parent) resolves a module specifier to an absolute path using Bun's resolver. Useful outside of Bun.build's native resolution.
Why backlog
The plugin spec uses Bun.build's plugin slot, which has its own resolver. We don't currently have a use case where userland code needs to do its own module resolution.
Trigger to promote to draft
- A plugin diagnostic feature ("which package satisfies this peer dep?"), OR
- A scaffold step that inspects a target dependency before installing.
Bun-unique classification
Bun-faster — import.meta.resolve covers the same ground on Node 22+; Bun's is faster and has been stable longer. Capability is not unique.
Open questions when promoted
- Async
Bun.resolvevs sync — pick one or expose both? - Conditional exports — do we need to expose the
conditionsargument to plugins?