'React typescript snowpack - can't import .webp
I just started using Snowpack for a React/Typescript project and initialized it with: https://www.npmjs.com/package/@snowpack/app-template-react-typescript. It looks very promising but I get an error [@snowpack/plugin-typescript] Cannot find module '../../dummy.webp or its corresponding type declarations when trying to import a .webp image. Somebody an idea how to get it working without using @ts-ignore?
Solution 1:[1]
Just found the solution. You need to add the following lines in types/static.d.ts:
declare module '*.webp' {
const ref: string;
export default ref;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jonathan |
