Skip to content

Nuxt.js 2 + nuxt-vite + pinia error #690

@maxdzin

Description

@maxdzin

Reproduction

Thank you so much for such a great state managing lib for Vue.
Pinia works well with Nuxt as well. However, when I tried to use it along with nuxt-vite, an issue happen from the start.
I tried with the fresh install and also, there is a reproduction link to Codesandbox:

Steps to reproduce the behavior

  1. Initialize a fresh Nuxt universal app + install the dependencies (the latest versions are used at the moment):
    "dependencies": { "@nuxtjs/composition-api": "^0.29.2", "@pinia/nuxt": "0.0.2", "nuxt": "^2.15.8", "pinia": "^2.0.0-rc.9" }, "devDependencies": { "nuxt-vite": "^0.2.4" }
  2. Add required modules into "buildModules" section of nuxt.config,js:
    buildModules: ["nuxt-vite", "@nuxtjs/composition-api/module", "@pinia/nuxt"],
  3. Run npm run dev
  4. See the error

Expected behavior

The app launched correctly with listed modules/configurations.

Actual behavior

The app won't launch because of the error.
This is comes in the console:
Uncaught SyntaxError: The requested module '/node_modules/pinia/dist/pinia.cjs?import' does not provide an export named 'defineStore'

Additional information

node version is 14.17.3
npm version is 7.24.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions