忽略我有一個tsconfig.json
文件在我的項目的根目錄:tsconfig.json通過Visual Studio代碼
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"noEmitHelpers": true,
"baseUrl": ".",
"paths": {
"services/*": ["./src/app/shared/services/*"]
}
},
"compileOnSave": false,
"buildOnSave": false,
"awesomeTypescriptLoaderOptions": {
"forkChecker": true,
"useWebpackText": true
}
}
我試圖定義我的路徑,所以我們並不需要在項目中使用相對路徑。
例如:
我想,而不必鍵入獲得import { ConfigService } from 'services/config';
工作,:
import { ConfigService } from '../../shared/services/config/';
,但我不斷收到中的WebPack錯誤,當我試試這個。
看起來它只是試圖在/node_nodules
看,而忽略tsconfig.json
?我對嗎?
我真的不知道我在做什麼錯。 Google搜尋了兩個多小時並且瘋了。
任何幫助,將不勝感激。
你完全正確,我在'webpack.config.js'中定義了'TsConfigPathsPlugin'插件並設置了'tsconfig.json',所有東西都開始工作了! –