Vetur ignores tsconfig.json in project (or at least the experimentalDecorators option) when running VSCode in workspace mode.
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.
https://github.com/vuejs/vetur/issues/567
https://github.com/nuxt-community/typescript-template/issues/5
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.
This is tracked in https://github.com/vuejs/vetur/issues/424
@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.
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.