Nuxt adding nonexistent import because of a pinia state property named "note"
See original GitHub issueEnvironment
- Operating System:
Windows_NT
- Node Version:
v16.14.0
- Nuxt Version:
3.0.0-27456065.f38cace
- Package Manager:
yarn@1.22.17
- Builder:
vite
- User Config:
dev
,env
,server
,build
,css
,buildModules
,ignore
,publicRuntimeConfig
,vite
- Runtime Modules:
-
- Build Modules:
@pinia/nuxt@0.1.8
,@vueuse/nuxt@8.0.1
,./modules/fonts/index.ts
Reproduction
Repo for reproduction: https://github.com/Bodokh/ReproduceNuxtError
1 .Start server with “nuxi dev” 2. Error in console: Uncaught SyntaxError: The requested module ‘/_nuxt/node_modules/@vueuse/core/index.mjs?v=0335339f’ does not provide an export named ‘note’
Describe the bug
pinia store file: applications.ts `import { defineStore } from “pinia”;
export type ApplicationState = { applications: any; currentCandidate: any; note: any; }
export const useApplicationsStore = defineStore({ id: “applications”, state: () => ({ applications: null, currentCandidate: null, note: null } as ApplicationState), actions: { async fetchApplications() { try { const { $axios } = useNuxtApp();
const { data } = await $axios.get('/applications');
this.$patch({
applications: data
});
} catch (err) {
console.log(err)
}
},
async fetchCandidate(id) {
try {
const { $axios } = useNuxtApp();
const { data } = await $axios.get(`/applications/${id}`);
this.$patch({
note: data.note,
currentCandidate: data
});
} catch (err) {
console.log(err)
}
},
async updateNote(note: any) {
const id = this.currentCandidate.id
const { $axios } = useNuxtApp();
try {
const result = await $axios.post(`/applications/${id}/update-note`, { note: note });
this.$patch({
note: note
})
return result.status == 200
} catch (err) {
console.log(err)
return false
}
}
}, getters: { getApplications: state => state.applications } }) `
in the browser this is how the file looks:
import { note } from '/_nuxt/node_modules/@vueuse/core/index.mjs?v=0335339f'; // this is the issue import { useNuxtApp } from '/_nuxt/node_modules/nuxt3/dist/app/index.mjs';import { defineStore } from "/_nuxt/node_modules/.vite/pinia_dist_pinia_mjs.js?v=0335339f"; export const useApplicationsStore = defineStore({ id: "applications", state: () => ({ applications: null, .......
When I replaced “note” with “notes” in the file this stopped happening…
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
Fixed in
@vueuse/* v8.1.2
unimport v0.1.1
Upgrade either of them the bug should go away.
I would check whether you are overriding the process.env.NODE_ENV variable anywhere. Perhaps in a
.env
file? (You shouldn’t, nor should you specifically setdev
in your config.)