Error building worker: No loader is configured for “.svg” files

Hey folks, I’ve got a Pages Remix app which uses svg icons. It’s built with vite, and works fine in local development with remix vite:dev, but running locally with wrangler page dev and deploying with wrangler pages deploy produces an error about the .svg files in my code:

✘ [ERROR] 1 error(s) and 0 warning(s) when compiling Worker. ✘ [ERROR] No loader is configured for “.svg” files: …/app/components/ui/icons/sprite.svg ../app/components/ui/icon.tsx:4:17: 4 │ import href from './icons/sprite.svg' ╵ ~~~~~~~~~~~~~~~~~~~~ ✘ [ERROR] Build failed with 1 error: …/app/components/ui/icon.tsx:4:17: ERROR: No loader is configured for “.svg” files: …/app/components/ui/icons/sprite.svg

Is there something special I need to do to allow this type of file in my project?
Was this page helpful?