Go to definition with import's namespace

Hey, 

I'm trying to use Babel Plugin for JavaScript Namespaces and I can’t figure out how to make Go To Definition working — currently I end up with “Cannot find declaration to go to”.

I'd appreciate any help or tips.

0
2 comments

Thgere are dozens of plugins defining their own ways to resolve modules, we can't afford providing special support for any of 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": {
"<utils>/*": "./src/js/*"
}
});

`<utils>` here is the alias you have defined in .babelrc

 

Now you can use imports like

import store from '<utils>/core/config/create-store';

in your code

0
Avatar
Permanently deleted user

Thank you. It did the trick! 

1

Please sign in to leave a comment.