2

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.

GuangWu
  • 378
  • 4
  • 14

1 Answers1

1

Plugin vite-plugin-svgr can do this.

GuangWu
  • 378
  • 4
  • 14