Skip to content

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

Merged
aklinker1 merged 4 commits into
wxt-dev:mainfrom
bompus:fix/bun-import-meta-resolve
Oct 4, 2026
Merged

aklinker1 merged 4 commits into
wxt-dev:mainfrom
bompus:fix/bun-import-meta-resolve

Conversation

@bompus

@bompus bompus commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

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 56416ad
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/6ac1ea9333832100080103dc
😎 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
Contributor Author

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

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bb09af02-f525-43cd-a775-bd7eb02dd048

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@aklinker1
aklinker1 disabled auto-merge October 4, 2026 05:55
Comment thread packages/wxt/src/core/resolve-config.ts Outdated
Comment thread packages/wxt/src/core/resolve-config.ts Outdated
@aklinker1 aklinker1 changed the title fix: use one-arg import.meta.resolve for Bun compatibility fix: use one-arg import.meta.resolve for Bun compatibility Oct 4, 2026
@aklinker1
aklinker1 enabled auto-merge (squash) October 4, 2026 05:57
@pkg-pr-new

pkg-pr-new Bot commented Oct 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

@wxt-dev/analytics

npm i https://pkg.pr.new/@wxt-dev/analytics@2607

@wxt-dev/auto-icons

npm i https://pkg.pr.new/@wxt-dev/auto-icons@2607

@wxt-dev/browser

npm i https://pkg.pr.new/@wxt-dev/browser@2607

@wxt-dev/i18n

npm i https://pkg.pr.new/@wxt-dev/i18n@2607

@wxt-dev/is-background

npm i https://pkg.pr.new/@wxt-dev/is-background@2607

@wxt-dev/module-react

npm i https://pkg.pr.new/@wxt-dev/module-react@2607

@wxt-dev/module-solid

npm i https://pkg.pr.new/@wxt-dev/module-solid@2607

@wxt-dev/module-svelte

npm i https://pkg.pr.new/@wxt-dev/module-svelte@2607

@wxt-dev/module-vue

npm i https://pkg.pr.new/@wxt-dev/module-vue@2607

@wxt-dev/runner

npm i https://pkg.pr.new/@wxt-dev/runner@2607

@wxt-dev/storage

npm i https://pkg.pr.new/@wxt-dev/storage@2607

@wxt-dev/unocss

npm i https://pkg.pr.new/@wxt-dev/unocss@2607

@wxt-dev/webextension-polyfill

npm i https://pkg.pr.new/@wxt-dev/webextension-polyfill@2607

wxt

npm i https://pkg.pr.new/wxt@2607

commit: 56416ad

@codecov

codecov Bot commented Oct 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 79.52%. Comparing base (7e2f64d) to head (56416ad).

Files with missing lines Patch % Lines
packages/wxt/src/core/resolve-config.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2607      +/-   ##
==========================================
- Coverage   79.63%   79.52%   -0.11%     
==========================================
  Files         138      138              
  Lines        4114     4113       -1     
  Branches      943      943              
==========================================
- Hits         3276     3271       -5     
- Misses        740      743       +3     
- Partials       98       99       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aklinker1
aklinker1 merged commit 966083d into wxt-dev:main Oct 4, 2026
20 checks passed
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Thanks for helping make WXT better!

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.

3 participants