vuejs / vetur

Vue tooling for VS Code.
https://vuejs.github.io/vetur/
MIT License
5.75k stars 594 forks source link

Red Squiggly in freshly initialized Vuetify project #3164

Open derekwisong opened 3 years ago

derekwisong commented 3 years ago

Info

Problem

The following code in a fresh Vuetify project shows a red squiggly and Vetur error 2307.

        <v-img
          :src="require('../assets/logo.svg')"
          class="my-3"
          contain
          height="200"
        />

Reproducible Case

  1. create new directory, open in vscode
  2. create new vue 2 project: vue create frontend
  3. add vuetify: cd frontend; vue add vuetify and select default install.
  4. add vetur.config.js to root of vscode directory containing the following and restart the VLS
// vetur.config.js
/** @type {import('vls').VeturConfig} */
module.exports = {
  // **optional** default: `{}`
  // override vscode settings
  // Notice: It only affects the settings used by Vetur.
  settings: {
    "vetur.useWorkspaceDependencies": true,
    "vetur.experimental.templateInterpolationService": true
  },
  // **optional** default: `[{ root: './' }]`
  // support monorepos
  projects: ['./frontend']
}

Screenshot from 2021-09-28 08-53-48

Screenshot of error attached

yoyo930021 commented 3 years ago

You only need a svg.d.ts file in src folder.

declare module '*.svg';