【发布时间】:2017-04-18 13:08:23
【问题描述】:
我的项目根目录中有一个tsconfig.json 文件:
{
"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?我说的对吗?
我真的不知道我做错了什么。在谷歌上搜索了几个多小时,我快疯了。
任何帮助将不胜感激。
【问题讨论】:
标签: angular typescript webpack visual-studio-code tsconfig