4

This is my babelrc file. installed module-resolver and declared root and aliases. actually this do works!! but underline annoying me... please click images below I cannot post images cause I'm new here. [https://i.stack.imgur.com/ZzN5O.png]

warning like this - module is not installed i think intelliJ recognize it as module..
[https://i.stack.imgur.com/GTcWx.png] I changed my root "./" -> "./src" but it didn't work. I also installed eslint but don't know about that well I think that won't help this problem

has anyone solved this kind of issue before?

1 Answers1

4

IDEA provides no special support for babel-resolver; please follow WEB-28241 for updates.

The problem is that there are dozens of plugins defining their own ways to resolve modules, we can't afford providing special support for all them... You can try using webpack aliases instead, or try a workaround from https://youtrack.jetbrains.com/issue/WEB-22717#focus=streamItem-27-1558931-0-0:

  • create a file config.js (you can use a different name if you like) in your project root dir

  • define your aliases there using the following syntax:

System.config({ "paths": { "components/*": "./src/components/*" } });

components here is the alias you have defined in .babelrc

Now you can use imports like

import MyComponent from 'components/core/MyComponent';

in your code

lena
  • 90,154
  • 11
  • 145
  • 150
  • Hi Lena, I've followed your suggestion. Now, I could cmd+click on my import and navigated to files. One that bothered me, my PHPStorm could not give auto import suggestion when I typed my aliases. For example, when I typed "@the", I expect PHPStorm will give import suggestion to "@themes". Now, I have to type the entire import statement manually. Any idea to solve that? – Izzuddiin Aug 12 '20 at 02:26