
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
svgo-loader
Advanced tools
$ npm install svgo-loader --save-dev
... or with Yarn
$ yarn add svgo-loader -D
module.exports = {
...,
module: {
rules: [
{
test: /\.svg$/,
type: 'asset',
loader: 'svgo-loader'
}
]
}
}
By default svgo-loader uses config from svgo.config.js similar to svgo cli.
See how to configure svgo.
Specify configFile option to load custom config module:
module.exports = {
...,
module: {
rules: [
{
test: /\.svg$/,
type: 'asset',
loader: 'svgo-loader',
options: {
configFile: './scripts/svgo.config.js'
}
}
]
}
}
or to disable loading config:
module.exports = {
...,
module: {
rules: [
{
test: /\.svg$/,
type: 'asset',
loader: 'svgo-loader',
options: {
configFile: false
}
}
]
}
}
You can also specify options which override loaded from config
module.exports = {
...,
module: {
rules: [
{
test: /\.svg$/,
type: 'asset',
loader: 'svgo-loader',
options: {
multipass: true,
js2svg: {
indent: 2,
pretty: true,
}
}
}
]
}
}
This software is released under the terms of the MIT license.
image-webpack-loader is a similar package that optimizes images, including SVGs, during the webpack build process. It uses various optimization tools like imagemin and SVGO. Compared to svgo-loader, image-webpack-loader is more versatile as it supports multiple image formats, not just SVG.
svg-url-loader is a webpack loader that inlines SVGs as URLs. It can also optimize SVGs using SVGO. Compared to svgo-loader, svg-url-loader provides additional functionality by converting SVGs into data URLs, which can be useful for embedding SVGs directly into HTML or CSS.
FAQs
svgo loader for webpack
The npm package svgo-loader receives a total of 355,241 weekly downloads. As such, svgo-loader popularity was classified as popular.
We found that svgo-loader demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.