Gathering detailed insights and metrics for vite-svg-loader
Gathering detailed insights and metrics for vite-svg-loader
Gathering detailed insights and metrics for vite-svg-loader
Gathering detailed insights and metrics for vite-svg-loader
vite-awesome-svg-loader
Imports SVGs as source code, base64 and data URI. Preserves stroke width, replaces colors with currentColor. Optimizes SVGs with SVGO. Creates SVG sprites.
@andylacko/vite-svg-react-loader
Vite plugin to transform SVGs into React components by default using svgr.
vite-svg-icon
可以方便的在vue2和vue3中使用`.svg`文件
vite-plugin-react-rich-svg
Seamless SVG loader with versatile import options! (Such as React component, dataURI and raw html code)
npm install vite-svg-loader
Typescript
Module System
Node Version
NPM Version
JavaScript (41.3%)
Vue (22.41%)
CSS (15.54%)
Shell (10.63%)
TypeScript (5.7%)
HTML (4.41%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
650 Stars
229 Commits
65 Forks
7 Watchers
2 Branches
18 Contributors
Updated on Jul 10, 2025
Latest Version
5.1.0
Package Id
vite-svg-loader@5.1.0
Unpacked Size
7.43 kB
Size
3.04 kB
File Count
5
NPM Version
10.1.0
Node Version
20.9.0
Published on
Nov 20, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Vite plugin to load SVG files as Vue components, using SVGO for optimization.
1<template> 2 <MyIcon /> 3</template> 4 5<script setup> 6import MyIcon from './my-icon.svg' 7</script>
1npm install vite-svg-loader --save-dev
vite.config.js
1import svgLoader from 'vite-svg-loader' 2 3export default defineConfig({ 4 plugins: [vue(), svgLoader()] 5})
SVGs can be imported as URLs using the ?url
suffix:
1import iconUrl from './my-icon.svg?url' 2// 'data:image/svg+xml...'
SVGs can be imported as strings using the ?raw
suffix:
1import iconRaw from './my-icon.svg?raw' 2// '<?xml version="1.0"?>...'
SVGs can be explicitly imported as Vue components using the ?component
suffix:
1import IconComponent from './my-icon.svg?component' 2// <IconComponent />
When no explicit params are provided SVGs will be imported as Vue components by default.
This can be changed using the defaultImport
config setting,
such that SVGs without params will be imported as URLs (or raw strings) instead.
vite.config.js
1svgLoader({
2 defaultImport: 'url' // or 'raw'
3})
vite.config.js
1svgLoader({ 2 svgoConfig: { 3 multipass: true 4 } 5})
vite.config.js
1svgLoader({ 2 svgo: false 3})
SVGO can be explicitly disabled for one file by adding the ?skipsvgo
suffix:
1import IconWithoutOptimizer from './my-icon.svg?skipsvgo' 2// <IconWithoutOptimizer />
If you use the loader in a Typescript project, you'll need to reference the type definitions inside vite-env.d.ts
:
1/// <reference types="vite/client" /> 2/// <reference types="vite-svg-loader" />
Thanks to Nexxtmove for sponsoring the development of this project.
Your logo or name here? Sponsor this project.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/5 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
28 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More