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.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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/core.

Basic Usage

  1. Install the plugin in your project:
npm install --save-dev esbuild-plugin-svgr
# or use yarn
yarn add --dev esbuild-plugin-svg
  1. Add this plugin to your esbuild build script:
const svgrPlugin = require('esbuild-plugin-svgr')

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

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

Author

Kazi Jawad

License

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

Acknowledgements

@svgr/core

FAQs

Package last updated on 24 Jan 2021

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