将 ng-packagr 用于我的 Angular 6 和 AngularCLI 应用程序,它无法识别我的 tsconfig 路径,因为我进行了构建。正常的 ng build --aot --prod 工作正常。
这些是我的路径:
"paths": {
"@app/*": ["src/app/*"],
"@env/*": ["src/environments/*"]
}
我的 tsconfig.json:
{
"compileOnSave": true,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"noImplicitAny": false,
"noImplicitReturns": true,
"noUnusedLocals": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
],
"paths": {
"@app/*": ["src/app/*"],
"@env/*": ["src/environments/*"]
}
}
}
我得到的错误往往是找不到模块....例如因为它不知道@app 是什么。
该应用程序在提供例如 npm start 时也可以正常工作。