esbuild-svgr-plugin
Version:
An esbuild plugin that transforms SVGs into React components using SVGR.
26 lines (25 loc) • 873 B
TypeScript
import type { Plugin } from 'esbuild';
/**
* An esbuild plugin that transforms SVG imports to imports of
* React components that wrap the SVGs.
* By default the plugin targets .svg files found
* in .(ts,js,tsx,tsx) files.
*
* If the filter or issuer matcher doesn't match an asset,
* the asset is resolved falling back to the rest of the plugin
* chain up to the defined default loader.
*
* The SVG React component is a default export.
*
* @param filter A regular expression that indicates which assets
* should be converted to a React component
* @param issuer A regular expression that controls on which
* files the imports should be transformed
*
* @returns
*/
export declare function svgrPlugin({ filter, issuer }?: {
filter?: RegExp | undefined;
issuer?: RegExp | undefined;
}): Plugin;
export default svgrPlugin;