The plugin does not co-operate with babel-plugin-module-resolver
See original GitHub issueResolution of svg path with the code
const svgPath = resolveFrom(dirname(iconPath), path.node.source.value);
does not take into account any path aliases configured with help of babel-plugin-module-resolver
.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Babel module resolver not working with react-native
My babel module resolver is not working with React-Native (neither does intellij in VScode). Here, Is my babel config
Read more >(React-Native) Unable to resolve module `screens` from `/front ...
(React-Native) Unable to resolve module screens from /front/App.js : Module screens does not exist in the Haste module map #354.
Read more >babel-plugin-module-resolver - npm
A Babel plugin to add a new resolver for your modules when compiling your code using Babel. This plugin allows you to add...
Read more >How do use babel plugin module resolver in react native
What is babel plugin module resolver || How to use Babel Module Resolver || What does Babel plugin Import do ? || What...
Read more >babel-plugin-module-resolver - npm package - Snyk
The npm package babel-plugin-module-resolver was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was deemed as ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@tkh44 Tried that and didn’t work, it partially worked (at least it the code broke somewhere else) when I also added “passPerPreset”: true, so I’m not sure if it was a theoretic fix or it actually worked for you, if so could you please share the full configuration code? 😃.
On the other hand I’ve created a pull request to allow passing an alias configuration to the plugin so it can be used on in conjunction with
babel-plugin-module-resolver
without issues. I’ve only tested for my use case so some testing would be needed if @kesne accepts the pull request.Pull request: https://github.com/kesne/babel-plugin-inline-react-svg/pull/17
After playing around for some more time, I believe, this is still a valid issue. The problem is that
babel-plugin-module-resolver
resolves import paths on exit from a node, thus no matter what is the order of Babel plugins in the config,babel-plugin-inline-react-svg
is executed beforebabel-plugin-module-resolver
, thus it does not use path aliases from the resolver. I have tried to updatebabel-plugin-inline-react-svg
to act on the exit from a node, after the resolver, but then Babel attempts to parse .svg content beforebabel-plugin-inline-react-svg
has a chance to properly transform it. Unfortunately, my knowledge of Babel plugin internals is close to zero, so I double, whether I can resolve this issue on my own 😦