-
-
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
Nuxt.js 2 + nuxt-vite + pinia error #690
Comments
I'm glad you like it ! |
Hi @posva |
It seems to be importing the wrong file of pinia but I'm not sure of why, could be a bug of nuxt-vite too. |
In the same setting (Nuxt 2 + vite) but with the most recent version of pinia, I got the following error The relevant part of the generated // --------------------
// Request: /@id/defaultexport:D:/Programming/JabRefOnline/node_modules/@pinia/nuxt/dist/templates/plugin.mjs
// Parents:
// - /.nuxt/index.js ($id_d8486045)
// Dependencies:
// - /node_modules/vue-demi/lib/index.mjs ($id_4c439bf5)
// - /node_modules/pinia/dist/pinia.mjs ($id_b1920624)
// --------------------
const $id_42c572ca = async function (global, __vite_ssr_exports__, __vite_ssr_import_meta__, __vite_ssr_import__, __vite_ssr_dynamic_import__, __vite_ssr_exportAll__) {
const module = __createCJSModule__(__vite_ssr_exports__)
const __vite_ssr_import_0__ = await __vite_ssr_import__("/node_modules/vue-demi/lib/index.mjs");
const __vite_ssr_import_1__ = await __vite_ssr_import__("/@id/pinia/dist/pinia.mjs/dist/pinia.mjs");
if (__vite_ssr_import_0__.isVue2) {
__vite_ssr_import_0__.Vue2.use(__vite_ssr_import_1__.PiniaVuePlugin);
} The problem is the strange import statement for pinia. In fact, if I remove the following const __vite_ssr_import_1__ = await __vite_ssr_import__("/node_modules/pinia/dist/pinia.mjs"); and the error is gone. |
The explicit nuxt alias leads to problems with nuxt/bridge (using vite) as descirbed here vuejs#690 (comment). Reverts vuejs@438b16d Fixes vuejs#690.
there's any update for this issue and pr #781? |
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
"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" }
buildModules: ["nuxt-vite", "@nuxtjs/composition-api/module", "@pinia/nuxt"],
npm run dev
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
The text was updated successfully, but these errors were encountered: