You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you want to load an SVG inline, e.g. import ExampleIcon from "icons/example.svg"; using inline-react-svg (as per the example in the repo found here ) and you are using absolute imports, the files will with not resolve.
Inline SVGs are quite common in modern web development and it currently requires a lot of config and additional packages in order to make work.
Additional context
You can fix this issue by installing the babel-plugin-module-resolver package and updating your .babelrc file as followings:
This discussion was converted from issue #14892 on April 12, 2021 11:56.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Feature request
If you want to load an SVG inline, e.g.
import ExampleIcon from "icons/example.svg";
usinginline-react-svg
(as per the example in the repo found here ) and you are using absolute imports, the files will with not resolve.Inline SVGs are quite common in modern web development and it currently requires a lot of config and additional packages in order to make work.
Additional context
You can fix this issue by installing the
babel-plugin-module-resolver
package and updating your.babelrc
file as followings:Proposed solution
Support the loading of SVG components by default (i.e. in the NextJS internals) without needing to manually update
.babelrc
Beta Was this translation helpful? Give feedback.
All reactions