1.2.0 • Published 3 years ago

react-app-rewire-svgr v1.2.0

Weekly downloads
23
License
MIT
Repository
github
Last release
3 years ago

react-app-rewire-svgr

Add SVGR loader to your create-react-app via react-app-rewired.

Installation

yarn add --dev react-app-rewire-svgr

OR

npm install --save-dev react-app-rewire-svgr

Usage

In your react-app-rewired configuration:

/* config-overrides.js */

const rewireSVGR = require('react-app-rewire-svgr');

module.exports = function override(config, env) {
    // ...
    config = rewireSVGR(config, env);
    // ...
    return config;
}

In your React application:

import starUrl, { ReactComponent as Star } from './star.svg'

const App = () => (
  <div>
    <Star />
  </div>
)

Also you can pass options to svgr webpack loader via third parameter

/* config-overrides.js */

const rewireSVGR = require('react-app-rewire-svgr');

module.exports = function override(config, env) {
    // ...
    config = rewireSVGR(config, env, { svgo: false });
    // ...
    return config;
}
1.2.0

3 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago