Skip to content

Commit fcc5157

Browse files
committed
docs(README): add caveats of bundle size
facebook/create-react-app#3856
1 parent fea3821 commit fcc5157

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ $ yarn add svgr.macro
2323

2424
_Note: You'll need to install and configure [babel-plugin-macros](https://github.com/kentcdodds/babel-plugin-macros) if you haven't already. (This can be omitted when using CRA [[email protected]](https://github.com/facebookincubator/create-react-app/issues/3815) .)_
2525

26+
## Caveats
27+
28+
### Bundle size impact
29+
30+
The macro solution is not suggested for every use case. If you import the same svg across multiple files, it will inflate the bundle size.
31+
32+
You should separate the `svgr.macro` function to a single file and import components from there. Please check the [example structure](https://github.com/evenchange4/svgr.macro-example/blob/master/src/Icons/index.js).
33+
34+
Related issue: https://github.com/facebook/create-react-app/issues/3856
35+
2636
## Example
2737

2838
[evenchange4/svgr.macro-example (with [email protected])](https://github.com/evenchange4/svgr.macro-example) [[DEMO](https://svgrmacro.netlify.com/)]

0 commit comments

Comments
 (0)