Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Javascript "Cannot Find Declaration to go to" when using custom module path

I'm trying to use Javascript ES6 import syntax with WebPack configured to use client and node_modules as root paths for resolving imports.

IntelliJ Idea discovers modules from "node_modules" directory, but it cannot resolve paths from "client" directory.

For example:

When im using:

  • import ImmutableStore from 'alt/utils/ImmutableUtil'; - IntelliJ finds proper paths, because alt module is on node_modules directory

  • import CustomiserActions from 'js/actions/Customiser.actions.js'; - It doesn't work, because js module is in client directory.

I've tried many options in module settings/project settings/marking directory as source roots/adding external libraries but nothing seems to work.

IntelliJ Idea version: 14.1.5

like image 386
kaz Avatar asked Oct 14 '15 14:10

kaz


1 Answers

I know this is old thread. Just for reference, mark the parent directory(in this case 'js') as 'Resource Root,' then Intellisense will work on 2016 version.

like image 99
cedzz Avatar answered Sep 21 '22 16:09

cedzz