Webstorm 11 "cannot resolve" warnings with import folders

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

This basically works, but WebStorm complains and emphasizes some module import names.

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

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

web server error

If replaced './home'with './home/index', however, underlining will go away.


Do I need to add '/ index' to all module names, or is there a way to tell WebStorm not to worry?

+4
source share
2 answers

-... WebStorm 2016


, , WebStorm 11, :

weak warning

weak warning

weak warning.

, Validate Imports.

Validate import: WebStorm


disable this inspection suppress it for current import ( WebStorm 11, IntelliJ)

" disable this inspection, suppress it for current import:

Alt+Enter, Right, Disable inspection, Suppress for statement "

, , (, )

to crush

----------

, TypeScript :

" import, import {b} " ./moduleB "/root/src/moduleA.ts, ". /moduleB ":

  • /root/src/moduleB.ts
  • /root/src/moduleB.ts
  • /root/src/moduleB.tsx
  • /root/src/moduleB.d.ts
  • /root/src/moduleB/package.json( "typings" )
  • //SRC/ moduleB/index.ts
  • /root/src/moduleB/index.tsx
  • /root/src/moduleB/index.d.ts "

http://www.typescriptlang.org/docs/handbook/module-resolution.html

+2

(WEB-19421) WebStorm 2016. , . Webpack (. WEB-17533 )

+2

All Articles