vite-plugin-svgr (2024)

4.2.0•Public•Published

vite-plugin-svgr (1)

Vite plugin to transform SVGs into React components. Uses svgr under the hood.

Installation

# npmnpm install --save-dev vite-plugin-svgr# yarnyarn add -D vite-plugin-svgr# pnpmpnpm add -D vite-plugin-svgr

Usage

// vite.config.jsimport svgr from "vite-plugin-svgr";export default { // ... plugins: [svgr()],};

Then SVG files can be imported as React components:

import Logo from "./logo.svg?react";

If you are using TypeScript, there is also a declaration helper for better type inference:

/// <reference types="vite-plugin-svgr/client" />

Options

svgr({ // svgr options: https://react-svgr.com/docs/options/ svgrOptions: { // ... }, // esbuild options, to transform jsx to js esbuildOptions: { // ... }, // A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should include. include: "**/*.svg?react", // A minimatch pattern, or array of patterns, which specifies the files in the build the plugin should ignore. By default no files are ignored. exclude: "",});

If you want to enable SVGO you can install @svgr/plugin-svgo and use following options to enable and configure it:

svgr({ svgrOptions: { plugins: ["@svgr/plugin-svgo", "@svgr/plugin-jsx"], svgoConfig: { floatPrecision: 2, }, }, // ...});

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i vite-plugin-svgr

Weekly Downloads

1,288,874

Version

4.2.0

License

MIT

Unpacked Size

9.56 kB

Total Files

8

Last publish

Collaborators

  • vite-plugin-svgr (2)

vite-plugin-svgr (2024)
Top Articles
How To Find Quarantined Emails In Outlook?
Send and Receive Stock
English Bulldog Puppies For Sale Under 1000 In Florida
Katie Pavlich Bikini Photos
Gamevault Agent
Pieology Nutrition Calculator Mobile
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Compare the Samsung Galaxy S24 - 256GB - Cobalt Violet vs Apple iPhone 16 Pro - 128GB - Desert Titanium | AT&T
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Craigslist Dog Kennels For Sale
Things To Do In Atlanta Tomorrow Night
Non Sequitur
Crossword Nexus Solver
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Energy Healing Conference Utah
Geometry Review Quiz 5 Answer Key
Hobby Stores Near Me Now
Icivics The Electoral Process Answer Key
Allybearloves
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Pearson Correlation Coefficient
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Marquette Gas Prices
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Vera Bradley Factory Outlet Sunbury Products
Pixel Combat Unblocked
Movies - EPIC Theatres
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Mia Malkova Bio, Net Worth, Age & More - Magzica
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Topos De Bolos Engraçados
Sand Castle Parents Guide
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Hello – Cornerstone Chapel
Stoughton Commuter Rail Schedule
Nfsd Web Portal
Selly Medaline
Latest Posts
Article information

Author: Rev. Leonie Wyman

Last Updated:

Views: 5938

Rating: 4.9 / 5 (79 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Rev. Leonie Wyman

Birthday: 1993-07-01

Address: Suite 763 6272 Lang Bypass, New Xochitlport, VT 72704-3308

Phone: +22014484519944

Job: Banking Officer

Hobby: Sailing, Gaming, Basketball, Calligraphy, Mycology, Astronomy, Juggling

Introduction: My name is Rev. Leonie Wyman, I am a colorful, tasty, splendid, fair, witty, gorgeous, splendid person who loves writing and wants to share my knowledge and understanding with you.