WebStorm報告在Angular 2 webpack boilerplate未觸及的分支上發生錯誤,請參閱下圖。錯誤消息是針對lib/index.ts文件中import {App} from './components/index';
行中的應用程序以及Corresponding file is not included in tsconfig.json
。但執行webpack-dev-server
不會導致錯誤,並且該應用在瀏覽器中運行良好。運行webpack可以運行,但WebStorm報告錯誤
如果我刪除從tsconfig.json如下:
"files": [
"lib/index.ts"
]
那麼錯誤消失。該應用程序也運行良好(也停止後,並開始webpack-dev-server
),但在webpack: bundle is now VALID.
之前有很多錯誤,都說... error TS2300: Duplicate identifier ...
,但如前所述,該應用程序工作正常。
如何解決這個問題,使WebStorm和webpack都快樂?