WaspW
Wasp14mo ago
Joaquim

Adding svgr plugin to the vite config

Hey!

I want to import svgs as React svg components instead of urls. So I installed the svgr vite plugin https://www.npmjs.com/package/vite-plugin-svgr.

Locally, it works perfectly but I can't deploy because the web-server folder doesn't build. The issue is
Cannot find module '../icons/icon.svg?react' or its corresponding type declarations.

21 import Icon from "../icons/dexindex.svg?react";


It seems like the web-server vite config correctly merges with the one from the root folder but it's not installed, or at least it doesn't show up in web-server's package.json.

Any ideas? I guess this issue would apply to any other vite plugin.
Was this page helpful?