π¦ plugin-svgr
An SVGR plugin to transform SVG files into React components automatically at build time.
Installationβ
- npm
- Yarn
- pnpm
- Bun
npm install --save @docusaurus/plugin-svgr
yarn add @docusaurus/plugin-svgr
pnpm add @docusaurus/plugin-svgr
bun add @docusaurus/plugin-svgr
tip
If you use the preset @docusaurus/preset-classic, you don't need to install this plugin as a dependency.
You can configure this plugin through the preset options.
Configurationβ
Accepted fields:
| Name | Type | Default | Description | 
|---|---|---|---|
| svgrConfig | object | {} | The SVGR config options, forwarded as is | 
Example configurationβ
You can configure this plugin through plugin options.
- Preset options
- Plugin options
If you use a preset, configure this plugin through the preset options:
docusaurus.config.js
module.exports = {
  presets: [
    [
      '@docusaurus/preset-classic',
      {
        svgr: {
          svgrConfig: {
            /* SVGR config */
          },
        },
      },
    ],
  ],
};
If you are using a standalone plugin, provide options directly to the plugin:
docusaurus.config.js
module.exports = {
  plugins: [
    [
      '@docusaurus/plugin-svgr',
      {
        svgrConfig: {
          /* SVGR config */
        },
      },
    ],
  ],
};