Skip to content
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

vite 创建vue项目,安装vuex后vscode报错,Could not find a declaration file for module 'vuex'. #2223

Open
WakerCN opened this issue May 10, 2023 · 7 comments

Comments

@WakerCN
Copy link

WakerCN commented May 10, 2023

使用npm init vue@latest安装的vue项目,
安装vuex后
store引入vuex,ts报错

Could not find a declaration file for module 'vuex'. 'g:/dg-b-front/node_modules/vuex/dist/vuex.mjs' implicitly has an 'any' type. There are types at 'g:/dg-b-front/node_modules/vuex/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'vuex' library may need to update its package.json or typings.ts(7016)

image

@dungtv1291
Copy link

same issue . Has anyone fixed it yet?

@WakerCN
Copy link
Author

WakerCN commented May 23, 2023

@dungtv1291 you can look this issue issues/2213
it seem vuex not maintain anymore
you can manual change file package.json in path node_modules\vuex\package.json
and add this
image

@dungtv1291
Copy link

fixing it in the node_modules folder is not a good idea

@masaha03
Copy link

Here is my workaround: #2213 (comment)

@JessicaFan
Copy link

@dungtv1291 you can look this issue issues/2213 it seem vuex not maintain anymore you can manual change file package.json in path node_modules\vuex\package.json and add this image

Although fixing it in the node_ modules folder is not a good idea, but. it does work. Many thxs

@liangliao-igc
Copy link

Solved: #2213 (comment)

@Ribeiro-Tiago
Copy link

I fixed this with a d.ts file, on my src/ directory

declare module "vuex" {
  export * from "vuex/types/index.d.ts";
  export * from "vuex/types/helpers.d.ts";
  export * from "vuex/types/logger.d.ts";
  export * from "vuex/types/vue.d.ts";
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants