Vetur: Vetur ignoring tsconfig.json from project when running VSCode in workspace mode

Created on 9 Feb 2018  路  8Comments  路  Source: vuejs/vetur

  • [x] I have searched through existing issues
  • [x] I have read through docs
  • [x] I have read FAQ

Info

  • Platform: Linux
  • Vetur version: 0.11.7
  • VS Code version: 1.20

Problem

Vetur ignores tsconfig.json in project (or at least the experimentalDecorators option) when running VSCode in workspace mode.

Reproducible Case

I used the nuxt TypeScript template from here and had the folder open in a workspace. I was simply getting this error message on decorators: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.

After some time i figured I might try without using the workspace so I opened the project directly and the error was gone. In addition I also tried placing the same tsconfig.json in the workspace directory which also worked.

I think vetur has no proper VSCode workspace functionality yet for finding the tsconfig.json.

Related issues

https://github.com/vuejs/vetur/issues/567
https://github.com/nuxt-community/typescript-template/issues/5

Most helpful comment

I have the same issue and i found little workaround in a workspace mode! If you place your nuxt/frontend project on the top of workspaces tree then Vetur obviously read tsconfig from this first workspace and everything works without warnings/errors in .vue files.

All 8 comments

I'm experiencing the same problem. If I just load up my project without a workspace everything works as expected. But the moment I load up my Vue project inside a workspace Vetur is not using the tsconfig.json file from the project.

@TheAkio How do you "place the same tsconfig.json in the workspace directory"?

@chris-dura You copy the tsconfig.json from your project directory and paste it into your workspace directory. A symlink might work too but I didn't test it. Basically there needs to be a tsconfig.json in your workspace directory too until this is fixed.

@TheAkio it does fix the problem, but at the same time, it no longer recognize the "@/components/HelloWorld.vue" file in the import statement
import HelloWorld from '@/components/HelloWorld.vue'; // @ is an alias to /src

@chungweileong94 I guess we might just have to use VSCode without multi-root-workspace when working on such applications.

I have the same issue and i found little workaround in a workspace mode! If you place your nuxt/frontend project on the top of workspaces tree then Vetur obviously read tsconfig from this first workspace and everything works without warnings/errors in .vue files.

@squalsoft That's a great workaround. I was facing the same issue - after generating Vue project using CLI, Vetur was giving me 2 errors:
Cannot find module '@/components/HelloWorld.vue'
and
Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning.

Opening my fresh Vue project in first workspace made error disappear.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tczhangzhi picture tczhangzhi  路  3Comments

pdanpdan picture pdanpdan  路  3Comments

gabrielboliveira picture gabrielboliveira  路  3Comments

deangoku picture deangoku  路  3Comments

LukeLin picture LukeLin  路  3Comments