Visual Studio Code: Initial VueJS setup cannot find module "@/.." Visual Studio Code: Initial VueJS setup cannot find module "@/.." vue.js vue.js

Visual Studio Code: Initial VueJS setup cannot find module "@/.."


Importing *.svg

VS Code doesn't know how to import an svg file on its own. To fix this, add a .d.ts file to the root of your project, containing:

declare module '*.svg' {  const content: any;  export default content;}

I found that adding this declaration to src/shims.d.ts does not work. It only worked when creating a .d.ts file at the project root (e.g., <root>/index.d.ts).

Expression expected error

That's from Vetur 0.11.7, which uses an older TypeScript version that doesn't support definite assignment assertions, introduced in TypeScript 2.7. (vuejs/vetur Issue #723)

Vetur 0.11.8 Preview fixes the issue by updating to the newer version of TypeScript, but this is not yet released, so you'll have to install the VSIX manually. The simplest method IMO is to use the command drop-down from VS Code's Extensions view to install the downloaded vetur-0.11.8.vsix. The fix is available in Vetur 0.12.1, which is installable from VS Code's Extensions view.