Webstorm 11 'cannot resolve' warnings with folder imports

I just cloned the Angular 2 Webpack Starter, and tried it in WebStorm 11.

It mostly works, but WebStorm complains and underlines some module import names.

For instance, in app.component.ts, the {Home} in import {Home} from './home'; is underlined in red.

When I hover the underlined module name, it reads: Cannot resolve symbol 'Home'

webstorm error

If I replace './home' by './home/index', though, the underlining goes away.


Will I have to add ‘/index’ to all the module names, or is there a way to tell WebStorm not to worry?

2
Leave a Reply

avatar
2 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Jason
Guest

Resolving imports from a folder problem (WEB-19421) is fixed in WebStorm 2016.
Note that it only works for paths relative to current file. Webpack-specific path mappings are not supported (see WEB-17533 and linked tickets)

Jason
Guest

The best way to solve this issue is to … upgrade to WebStorm 2016 In the meantime, here are some temporary measures you could adopt in WebStorm 11 to spare your eyes: weak warning Change the severity of the error to Weak Warning. This will display the error in a less aggressive manner, while keeping the Validate Imports option on. For more info about disabling Validate imports: disable inspections in WebStorm disable this inspection or suppress it for current import (tweaks for WebStorm 11 provided by IntelliJ support team) One can ” either disable this inspection or suppress it for… Read more »