How to integrate svgo into vite react project

462 Views Asked by At

It's a useful feature in create-react-app that I can use svg as a react component:

import { ReactComponent as NotFound } from '@/assets/images/not-found.svg'

function Error() {
  return (
    <div>
      <NotFound className="logo" />
    </div>
  )
}
export default Error

I want this feature in my new vite project, but I didn't find any tutorials or blog posts about this.

1

There are 1 best solutions below

0
On

Plugin vite-plugin-svgr can do this.