question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The plugin does not co-operate with babel-plugin-module-resolver

See original GitHub issue

Resolution 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:open
  • Created 6 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
Zaggencommented, Jul 3, 2017

@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

2reactions
birdofpreyrucommented, May 16, 2017

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 before babel-plugin-module-resolver, thus it does not use path aliases from the resolver. I have tried to update babel-plugin-inline-react-svg to act on the exit from a node, after the resolver, but then Babel attempts to parse .svg content before babel-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 😦

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found