Plugin Doesn't Work With babel-plugin-module-resolver
See original GitHub issueI recently discovered that when you try to use this plug-in with another Babel plug-in, module-resolver, it breaks. That plug-in re-writes the paths of import
statements, for instance transforming "~/src/foo"
to "projectRoot/src/foo"
.
For instance:
// a.js
export const foo = 1;
// b.js
import {foo} from '~/a';
// c.js
import('./b');
results in:
ERROR in ./c.js Module not found: Error: Can’t resolve ‘~/a’ in …
Presumably this is happening because when c
imports b
this plug-in somehow bypasses the module-resolver plug-in. While this may well be module-resolver’s fault, it could also be this library’s, so I figured I’d try submitting the issue here first.
Ultimately it would be nice if these two great plug-ins could work together. Thanks.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Babel module resolver not working with react-native
I had the same problem, I just removed the '@' from my aliases and it seems working fine now. Here is my babel.config.js...
Read more >It doesn't resolve paths to files · Issue #424 - GitHub
I'm trying to use the plugin for css, graphql file mocks in order to run nodejs on tests. ... It doesn't resolve paths...
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
babel - plugin - module - resolver | Yarn - Package Manager || Babel module resolver doesn't work as expected || Why You...
Read more >babel-plugin-module-resolver - npm package - Snyk
Learn more about babel-plugin-module-resolver: package health score, popularity, security, maintenance, versions and more.
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
Good point @ljharb I thought it was related at first but then realised my module resolver setup is only used in SSR! The issue I have is more specific to webpack with a custom resolve configuration and most likely unrelated to this setting.
Thanks. I tried creating https://github.com/tleunen/babel-plugin-module-resolver/issues/268 over there.