79460229

Date: 2025-02-22 20:15:28
Score: 1
Natty:
Report link

If you are using vite & react , use vite-plugin-svgr.

  1. Install plugin: yarn add -D vite-plugin-svgr

  2. Add this in the plugins array of vite.config.ts plugins: [svgr()],

  3. Import the svg in your component :import Logo from "./logo.svg?react"; keep in mind the ?react part.

  4. Add this in your vite-env.d.ts to get rid of type error /// <reference types="vite-plugin-svgr/client" />

Refer this link for more information: http://github.com/pd4d10/vite-plugin-svgr?tab=readme-ov-file#usage

Reasons:
  • Blacklisted phrase (1): this link
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: jinn