3

I get a typescript error in my vite project when I try to import an SVG with a suffix (?component). How can I configure typescript to ignore these suffixes?

TS2307: Cannot find module './desktop-mark.svg?component' or its corresponding type declarations.

import DesktopLogoMark from './desktop-mark.svg?component';
Carl Wirkus
  • 523
  • 1
  • 8
  • 19

1 Answers1

3

You need to add module declaration: https://www.typescriptlang.org/docs/handbook/modules.html#wildcard-module-declarations