Uncaught ReferenceError: useEffect is not defined
Open
Nobody has claimed this yet.
pending-triage
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 564
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
I noticed an issue. When I set vite build.target to esnext, the auto-import feature stops working.
https://github.com/user-attachments/assets/64a73876-4122-426f-a2d7-58e8a60289ff
Reproduction
https://github.com/rxliuli/wxt-esnext-error-demo
Steps to reproduce
No response
System Info
System:
OS: macOS 15.5
CPU: (12) arm64 Apple M2 Max
Memory: 15.30 GB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.14.0 - /usr/local/bin/node
npm: 10.9.2 - /usr/local/bin/npm
pnpm: 10.5.2 - /usr/local/bin/pnpm
bun: 1.1.6 - ~/.bun/bin/bun
Browsers:
Brave Browser: 131.1.73.105
Chrome: 137.0.7151.69
Edge: 128.0.2739.54
Safari: 18.5
npmPackages:
wxt: ^0.20.6 => 0.20.7
Used Package Manager
pnpm
Validations
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the linked wxt-esnext-error-demo reproduction with Vite build.target set to esnext and inspect the generated output around the missing useEffect reference. Compare the auto-import behavior with a non-esnext target and verify that the reproduction no longer produces the uncaught ReferenceError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 39/100