忽略我有一个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',所有东西都开始工作了! –