-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
autoimport Nuxt eventemitter3 does not provide an export named 'default' #3977
Comments
I would like to work on this issue and contribute the necessary changes. |
maybe @danielroe can take a quick professional look and help? https://github.com/wevm/wagmi/blob/main/packages/vue/src/nuxt/module.ts |
This is likely because without the explicit import, vite doesn't know to optimize the dep. You can manually add it to optimize-deps: https://vitejs.dev/config/dep-optimization-options.html#optimizedeps-include. |
like ? nuxt.hook('vite:extendConfig', (config) => {
config.optimizeDeps ??= {}
config.optimizeDeps.include = config.optimizeDeps.include || []
config.optimizeDeps.include.push('@wagmi/vue')
}) |
Exactly that kind of thing! Note that this requires the end user to have installed the dep. If it is a dependency of your module you would do something like |
hey, adding kudos @danielroe |
hey @yulafezmesi was this how you added it ? //nuxt.config.ts
|
I referred to the // wagmi.ts
import { http, cookieStorage, createConfig, createStorage } from 'wagmi'
import { mainnet, sepolia } from 'wagmi/chains'
import { coinbaseWallet, injected, walletConnect } from 'wagmi/connectors'
export function getConfig() {
return createConfig({
chains: [mainnet, sepolia],
connectors: [
injected(),
coinbaseWallet(),
walletConnect({ projectId: process.env.NEXT_PUBLIC_WC_PROJECT_ID }),
],
storage: createStorage({
storage: cookieStorage,
}),
ssr: true,
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
})
}
declare module 'wagmi' {
interface Register {
config: ReturnType<typeof getConfig>
}
} // nuxt.config.ts
import { defineNuxtConfig } from 'nuxt/config'
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
devtools: { enabled: true },
modules: ['@wagmi/vue/nuxt'],
}) // plugins/wagmi.ts
import { VueQueryPlugin } from '@tanstack/vue-query'
import { WagmiPlugin } from '@wagmi/vue'
import { defineNuxtPlugin } from 'nuxt/app'
import { config } from '../wagmi'
// TODO: Move to @wagmi/vue/nuxt nitro plugin
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(WagmiPlugin, { config }).use(VueQueryPlugin, {})
}) |
Describe the bug
If you delete imports, Nuxt auto-imports do not work:
for example works:
not working:
Link to Minimal Reproducible Example
https://stackblitz.com/~/github.com/reslear/nuxt-wagmi-starter
Steps To Reproduce
clone repo github.com/reslear/nuxt-wagmi-starter
install and run dev:
components/Account.vue
and comment import line:Wagmi Version
latest
Viem Version
latest
TypeScript Version
latest
Check existing issues
Anything else?
No response
The text was updated successfully, but these errors were encountered: