npm.devtool.tech
👏 You can access @stefanprobst/svgo-loader package with using stefanprobstSvgoLoader variable in browser devtools!
Webpack loader to optimize svg images with [svgo](https://github.com/svg/svgo). Produces an svg string, so another loader like `file-loader` is needed to actually emit the transformed file.

basic

package
Npm Version
Node Version

popularity

Star
Npm Weekly Downloads
Jsdeliver Month Downloads
Dependents Pkg
Dependents Repo

size

Code Size
Publish Size
Install Size
Minified Size
Gzip Size

quality

Open Issues
Tree Shaking Support
Type Support
Last Commit

health

Package health
Dependency Count
Outdated Dep
Vulnerablities

svgo-loader

Webpack loader to optimize svg images with svgo. Produces an svg string, so another loader like file-loader is needed to actually emit the transformed file.

How to use

// webpack.config.js

module.exports = {
  /* ... */
  module: {
    rules: [
      {
        test: /\.svg$/,
        use: [
          {
            loader: require.resolve('file-loader'),
          },
          {
            loader: require.resolve('@stefanprobst/svgo-loader'),
            options: {
              plugins: [
                {
                  name: 'preset-default',
                  params: {
                    overrides: {
                      removeViewBox: false,
                    },
                  },
                },
                { name: 'removeDimensions' },
              ],
            },
          },
        ],
      },
    ],
  },
}

Options

Use the plugins option to enable/disable and configure svgo plugins. Note that providing a plugins option overrides the default plugin preset. Use preset-default to include it.