Skip to content

fix(vue): add eventemitter3 to optimizeDeps for Nuxt compatibility#5028

Merged
tmm merged 4 commits intowevm:mainfrom
faizkhairi:fix/nuxt-eventemitter3-esm
Mar 23, 2026
Merged

fix(vue): add eventemitter3 to optimizeDeps for Nuxt compatibility#5028
tmm merged 4 commits intowevm:mainfrom
faizkhairi:fix/nuxt-eventemitter3-esm

Conversation

@faizkhairi
Copy link
Copy Markdown
Contributor

Summary

Fixes Nuxt auto-import failures caused by eventemitter3 (a CJS dependency of @wagmi/core) not being pre-bundled by Vite when there is no explicit import statement in user code.

When using @wagmi/vue/nuxt auto-imports, the browser throws:

SyntaxError: The requested module 'eventemitter3/index.js' does not provide an export named 'default'

Fix

Adds eventemitter3 to Vite's optimizeDeps.include via the vite:extendConfig hook in the Nuxt module setup. This ensures Vite pre-bundles the CJS package into an ESM-compatible format, matching the approach recommended by @danielroe in #3977 (comment).

Changes

  • packages/vue/src/nuxt/module.ts -- added vite:extendConfig hook to include eventemitter3 in optimizeDeps

Fixes #3977

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 21, 2026

@faizkhairi is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 21, 2026

🦋 Changeset detected

Latest commit: 3865b69

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@wagmi/vue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@tmm tmm merged commit b307f48 into wevm:main Mar 23, 2026
4 of 5 checks passed
@faizkhairi
Copy link
Copy Markdown
Contributor Author

faizkhairi commented Mar 24, 2026

Thanks @tmm for the imports fix and etc! Happy to be able help and contribute for wagmi. 😄 🎉

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

autoimport Nuxt eventemitter3 does not provide an export named 'default'

2 participants