Transform SVGs into React components
npm install -D @rambler-tech/razzle-svgr
or
yarn add -D @rambler-tech/razzle-svgr
Add the plugin to razzle.config.js
const SvgrPlugin = require('@rambler-tech/razzle-svgr')
module.exports = {
plugins: [
SvgrPlugin()
],
modifyWebpackConfig({webpackConfig}) {
// ...
return webpackConfig
}
}
It's also possible to provide args from svgr plugin
const SvgrPlugin = require('@rambler-tech/razzle-svgr')
module.exports = {
plugins: [
SvgrPlugin({
native: true,
})
],
modifyWebpackConfig({webpackConfig}) {
// ...
return webpackConfig
}
}