Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Worker setup causing variable not defined #1424

Open
5 tasks done
Justineo opened this issue Feb 12, 2025 · 0 comments
Open
5 tasks done

Worker setup causing variable not defined #1424

Justineo opened this issue Feb 12, 2025 · 0 comments
Labels
pending-triage Someone (usually a maintainer) needs to look into this to see if it's a bug

Comments

@Justineo
Copy link

Describe the bug

I am importing and instantiating a worker in WXT, but the added iifeReturnValueName leads to accessing an undefined variable.

Reproduction

https://github.com/Justineo/wxt-repro

Steps to reproduce

  1. Clone the repo.
  2. Run pnpm dev.
  3. Side-load the extension in Chrome.
  4. Open the console and navigate to any webpage.

And in the console you will see:

Uncaught ReferenceError: content is not defined

worker.ts is transformed into:

(function() {
  "use strict";
  console.log("From worker");
  content;
})();
content;

Where content is not defined.

System Info

System:
    OS: macOS 14.6.1
    CPU: (14) arm64 Apple M3 Max
    Memory: 52.42 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.13.0 - ~/.volta/tools/image/node/22.13.0/bin/node
    npm: 10.9.2 - ~/.volta/tools/image/node/22.13.0/bin/npm
    pnpm: 9.15.5 - ~/.volta/bin/pnpm
  Browsers:
    Chrome: 133.0.6943.54
    Chrome Canary: 135.0.7012.0
    Edge: 133.0.3065.59
    Safari: 18.0
  npmPackages:
    wxt: ^0.19.13 => 0.19.27

Used Package Manager

pnpm

Validations

@Justineo Justineo added the pending-triage Someone (usually a maintainer) needs to look into this to see if it's a bug label Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-triage Someone (usually a maintainer) needs to look into this to see if it's a bug
Projects
None yet
Development

No branches or pull requests

1 participant