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

Vetur is not reading Vuetify type definition files from the right place #1385

Closed
3 tasks done
lbssousa opened this issue Aug 12, 2019 · 7 comments
Closed
3 tasks done

Comments

@lbssousa
Copy link

lbssousa commented Aug 12, 2019

  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: Linux
  • Vetur version: 0.22.0
  • VS Code version: 1.37.0

Problem

Vetur is unable to read Vuetify type definition files alacarte.d.ts, colors.d.ts, index.d.ts and lib.d.ts from their current location (node_modules/vuetify/types). Instead, it's trying to read them from node_modules/vuetify/lib.

If I copy/symlink manually these files to node_modules/vuetify/lib, Vetur read them as expected, but vue-cli fails to build my project.

@octref
Copy link
Member

octref commented Aug 12, 2019

@nekosaur FYI

@nekosaur
Copy link
Contributor

@lbssousa Please add some kind of reproduction steps of what your project setup looks like and which steps you take to get the error.

@lbssousa
Copy link
Author

lbssousa commented Aug 14, 2019

I've setup an example project at https://github.com/lbssousa/vuetify-ts-example. You can see the problem in file src/components/HelloWorld.vue.

If I keep my project's node_modules folder untouched, Vetur gives me the following error:
Captura de tela de 2019-08-14 09-04-10

On the other hand, if I move/copy/symlink all *.d.ts files from node_modules/vuetify/types to mode_modules/vuetify/lib, that error disappears:
Captura de tela de 2019-08-14 09-10-22

@nekosaur
Copy link
Contributor

Okay. This is not related to vetur. You need to add vuetify to types array in your tsconfig.json file.

@lbssousa
Copy link
Author

Now I realize what's going on...

In my project, I have separate folders for both frontend and backend, and I currently have multiple frontend alternatives (e.g.: my-project/frontend-vuetify2-class-api and my-project/frontend-vuetify2-function-api). I've added "vuetify" to types array in both alternatives' tsconfig.json files.

If I open folder my-project in VSCode, it seems unable to read file tsconfig.json from each frontend alternative, leading to Vuetify error above. However, if I open directly one of my frontend alternatives' folder in VSCode, it reads its tsconfig.json file correctly, and that Vuetify type error disappears.

I've tryed to copy one of my frontend folders' tsconfig.json file to my-project root folder, but the problem still remains.

@nekosaur
Copy link
Contributor

nekosaur commented Oct 5, 2019

@octref this can be closed. It's unrelated to vetur.

@patarapolw
Copy link

patarapolw commented Oct 31, 2019

It seems to be relate to Vetur in that Vetur does not read tsconfig.json in the right place, when it is modified.

Also a bug on Vuetify part -- vuetifyjs/vuetify#3943

Currently, after tsconfig.json correction, there is this.$vuetify in main.ts, but not in App.vue.

Got a solution by modifying shims-vue.d.ts;

// declare module '*.vue' {
//   import Vue from 'vue'
//   export default Vue
// }

declare module '*.vue' {
  import  "vuetify"
}

@octref octref closed this as completed Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants