Skip to content

fix(wxt): explain missing globals when loading entrypoints - #2679

Open
appdever01 wants to merge 1 commit into
wxt-dev:mainfrom
appdever01:fix/entrypoint-errors
Open

appdever01 wants to merge 1 commit into
wxt-dev:mainfrom
appdever01:fix/entrypoint-errors

Conversation

@appdever01

Copy link
Copy Markdown

Overview

When an entrypoint uses an unavailable browser global outside its main function, preparation and builds fail with a bare ReferenceError. Include the entrypoint path, explain the build-time Node.js environment and link the entrypoint loader documentation so the error points to a solution.

The original error and stack are retained as the cause. Unrelated failures, including other ReferenceErrors, are rethrown unchanged.

Manual Testing

Add new MutationObserver(() => {}); above a content script definition, then run wxt prepare or build. The error includes the entrypoint path, guidance to move browser API calls into main, and the documentation link. Moving the browser call inside main allows preparation and builds to succeed.

Local validation on macOS:

  • bun run test run e2e/tests/entrypoint-errors.test.ts --maxWorkers=2 from packages/wxt: all nine cases pass. Five diagnostic cases fail against the original importer.
  • The full core WXT suite, package production build and checks, and root checks pass.
  • Production CLI smoke tests pass under Node and Bun for prepare/build/dev failures, unchanged unrelated errors, and valid browser usage inside main.

Related Issue

This PR closes #1056

@netlify

netlify Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 5d8de2f
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/6ad6a734323028ef5f5eea69
😎 Deploy Preview https://deploy-preview-2679--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.

@coderabbitai

coderabbitai Bot commented Oct 19, 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: 87c81ede-29dd-40c3-a5fb-b87675e303c7

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions github-actions Bot added the pkg/wxt Includes changes to the `packages/wxt` directory label Oct 19, 2026

This branch has not been deployed

No deployments
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.

Improved error message when entrypoint loading fails

1 participant