Skip to content

fix: use one-arg import.meta.resolve for Bun compatibility - #2607

Open
bompus wants to merge 1 commit into
wxt-dev:mainfrom
bompus:fix/bun-import-meta-resolve
Open

fix: use one-arg import.meta.resolve for Bun compatibility#2607
bompus wants to merge 1 commit into
wxt-dev:mainfrom
bompus:fix/bun-import-meta-resolve

Conversation

@bompus

@bompus bompus commented Aug 30, 2026

Copy link
Copy Markdown

Summary

  • Bun's two-argument import.meta.resolve(specifier, parent) fails for bare package names (Cannot find package 'wxt' when resolving from inside the package, and the same for WXT modules with a synthetic …/index.js parent).
  • Switch resolveWxtModuleDir and resolveWxtUserModules to one-arg import.meta.resolve, which works on both Bun and Node.
  • Lets bunx --bun wxt / bun --bun run the WXT CLI (verified: HMR + production build).

Related

  • Bun: filing companion issue for two-arg import.meta.resolve package-name failures.

Test plan

  • bunx --bun wxt --help in a project that depends on wxt
  • bunx --bun wxt (dev) starts without Cannot find package 'wxt'
  • Project using @wxt-dev/unocss (or other modules:) still loads modules under Bun and Node
  • Existing Node-based npx wxt / node …/wxt.mjs still works

Bun's two-arg import.meta.resolve(specifier, parent) fails for bare package
names (Cannot find package 'wxt' / '@wxt-dev/…'). One-arg resolve works on
both Bun and Node, so WXT CLI can run under bun --bun / bunx --bun.
@bompus
bompus requested a review from aklinker1 as a code owner August 30, 2026 02:10
@netlify

netlify Bot commented Aug 30, 2026

Copy link
Copy Markdown

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 12a0228
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/6a939119d6790b0008ef56d7
😎 Deploy Preview https://deploy-preview-2607--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the pkg/wxt Includes changes to the `packages/wxt` directory label Aug 30, 2026
@bompus

bompus commented Aug 30, 2026

Copy link
Copy Markdown
Author

Companion Bun issue for the two-arg import.meta.resolve failure: oven-sh/bun#40931

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg/wxt Includes changes to the `packages/wxt` directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant