У меня есть проект angular cli, и я создал новую библиотеку:
ng g library test
Теперь в файле tsconfig.json я добавил следующие параметры paths:
{
"compileOnSave": false,
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"baseUrl": ".",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"typeRoots": ["node_modules/@types"],
"lib": ["es2018", "dom"],
"paths": {
"@scope/name": ["projects/test/src/public_api.ts"]
}
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}
Но теперь, когда я пытаюсь использовать его в приложении:
import { SomeComponent } from '@scope/name';
@NgModule({
...
})
export class AppModule {}
Я получаю сообщение об ошибке:
error TS2307: Cannot find module '@scope/name'.





Вы можете использовать файл . У вас просто опечатка. Так должно быть:
"@scope/name": ["projects/test/src/public-api.ts"]