nuxt / nuxt

The Intuitive Vue Framework.
https://nuxt.com
MIT License
52.94k stars 4.86k forks source link

Nuxt 3.12.1 Error: does not provide an export named 'setupDevtoolsPlugin' #27544

Open mrchoke opened 2 weeks ago

mrchoke commented 2 weeks ago

Environment

Nuxt project info: 1:06:56 AM (+7)


Reproduction

Error: upgrade from Nuxt 3.11.2 to 3.12.1 Work: downgrade to Nuxt 3.11.2

Describe the bug

it show message

The requested module '/_nuxt/node_modules/.pnpm/@vue+devtools-api@6.6.3/node_modules/@vue/devtools-api/lib/cjs/index.js' does not provide an export named 'setupDevtoolsPlugin'

Screenshot 2024-06-12 at 01 12 14

Additional context

No response

Logs

nuxt.js?v=130e9795:122 [nuxt] error caught during app initialization SyntaxError: The requested module '/_nuxt/node_modules/.pnpm/@vue+devtools-api@6.6.3/node_modules/@vue/devtools-api/lib/cjs/index.js' does not provide an export named 'setupDevtoolsPlugin' (at index.mjs?v=130e9795:79:15)Caused by: SyntaxError: The requested module '/_nuxt/node_modules/.pnpm/@vue+devtools-api@6.6.3/node_modules/@vue/devtools-api/lib/cjs/index.js' does not provide an export named 'setupDevtoolsPlugin' (at chunk-IYZISRBI.js?v=130e9795:3:10)
ZTL-UwU commented 2 weeks ago

I'm able to reproduce this with the vee-velidate zod integration. https://stackblitz.com/~/github.com/ZTL-UwU/nuxt-3.12.1-setupDevtoolsPlugin-repro

vasilistotskas commented 2 weeks ago

Im facing same error after updating nuxt to 3.12.1 and using :

  future: {
    compatibilityVersion: 4,
  },

The error is:

Uncaught SyntaxError: The requested module '/_nuxt/@fs/C:/Dev/grooveshop-dev/grooveshop-storefront-ui-node-nuxt/node_modules/.pnpm/@vue+devtools-api@6.6.3/node_modules/@vue/devtools-api/lib/cjs/index.js' does not provide an export named 'setupDevtoolsPlugin' (at vee-validate.esm.js:7:10)

Im running pnpm version 9.3.0

vasilistotskas commented 2 weeks ago

After adding "@vue/devtools-api": "6.6.3", as a dev dependency the error gone

danielroe commented 2 weeks ago

I wonder if we need to add @vue/devtools-api to vite.optimizeDeps.include - or perhaps exclude(?). cc: @antfu

shaunnbarron commented 1 week ago

After adding "@vue/devtools-api": "6.6.3", as a dev dependency the error gone

This works for me in dev, but building is a no-go.

danielroe commented 1 week ago

This seems to be an upstream issue. I think the following should resolve it for you:

export default defineNuxtConfig({
  vite: {
    optimizeDeps: {
      exclude: ['vee-validate']
    }
  },
  modules: ['@vee-validate/nuxt'],
})

This may be worth adding to the @vee-validate/nuxt module, but I'm a little unsure as vee-validate does not expose a valid ESM build - and does not have export conditions either.

cc: @antfu