Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

esbuild-plugin-svgr

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-plugin-svgr

A plugin for esbuild that enables importing *.svg files as React components.

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
55K
increased by1.02%
Maintainers
1
Weekly downloads
 
Created
Source

esbuild-plugin-svgr

A plugin for esbuild that adds support for *.svg file imports as React components. The plugin is built on top of SVGR.

Basic Usage

  1. Install the plugin in your project:
npm install --save-dev esbuild-plugin-svgr
# or use yarn
yarn add --dev esbuild-plugin-svgr
  1. Add this plugin to your esbuild build script:
import esbuild from 'esbuild'
import svgr from 'esbuild-plugin-svgr'

await esbuild.build({
    plugins: [
        svgr(),
    ],
})
  1. Import your *.svg file from JavaScript:
import Icon from './icon.svg';

function App() {
    return (
        <div>
            <Icon />
        </div>
    );
}
  1. Pass in optional supported configuration options:
esbuild.build({
    plugins: [
        svgr({ ref: true }),
    ],
});

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgements

SVGR

FAQs

Package last updated on 16 May 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc