-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dfe94df
commit 869037c
Showing
4 changed files
with
1,268 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# SVGR Plugin | ||
|
||
Transform SVGs into React components | ||
|
||
## Install | ||
|
||
``` | ||
npm install -D @rambler-tech/razzle-svgr | ||
``` | ||
|
||
or | ||
|
||
``` | ||
yarn add -D @rambler-tech/razzle-svgr | ||
``` | ||
|
||
## Usage | ||
|
||
Add the plugin to `razzle.config.js` | ||
|
||
```js | ||
const SvgrPlugin = require('@rambler-tech/razzle-svgr') | ||
|
||
module.exports = { | ||
plugins: [ | ||
SvgrPlugin() | ||
], | ||
modifyWebpackConfig({webpackConfig}) { | ||
// ... | ||
return webpackConfig | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = () => ({ | ||
modifyWebpackConfig({webpackConfig}) { | ||
webpackConfig.module.rules[1].exclude.push(/\.svg$/) | ||
|
||
webpackConfig.module.rules.push({ | ||
test: /\.svg$/, | ||
use: ['@svgr/webpack'] | ||
}) | ||
|
||
return webpackConfig | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "@rambler-tech/razzle-svgr", | ||
"version": "0.0.0", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@svgr/webpack": "^8.1.0" | ||
}, | ||
"peerDependencies": { | ||
"razzle": ">=4", | ||
"webpack": ">=5" | ||
} | ||
} |
Oops, something went wrong.