-
Notifications
You must be signed in to change notification settings - Fork 6
Conversation
The separate variable What do you think about doing it like so? It's maybe a little bit hacky...
|
I wanted to omit such hacky solutions, but when the cause is good I can't say no 😄 I will change it. |
Alternatively, since we already only load |
const useSvgLoader = allowSvgLoader || strictSvgLoader; | ||
|
||
// This loader allows to parse SVG as JSX | ||
if (isSvgLoaderParamDefined && useSvgLoader) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isSvgLoaderParamDefined
is superfluous in this case.
exclude: /node_modules/, | ||
loader: 'svg-react-loader', | ||
} | ||
: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You forgot to do oneOf: loaders
in the prod file.
README.md
Outdated
@@ -65,3 +65,12 @@ Importing any stylesheet from JS (with CSS Modules enabled) will convert class n | |||
@import '~react-select/dist/react-select'; | |||
} | |||
``` | |||
#### 5. SVG as JSX, is it even possible? | |||
Importing SVGs as JSX is possible, but only SVGs suffixed with `.inline` will be treated as JSX code (fe. `logo.inline.svg`): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're showing an example using logo.inline.svg
just below, the crossed out part is unnecessary, I think:
Importing SVGs as JSX is possible, but only SVGs suffixed with
.inline
will be treated as JSX code(fe.:logo.inline.svg
)
This is proposal of optional way of handling importing SVGs as JSX with usage of
svg-react-loader
.