问题
I am using Angular library and have the following folder structure:
coollibrary
- components
- my.component.ts
- services
- my.service.ts
public_api.ts
In public_api, I export the component and service and make the library build. After that I can import the necessary things in my project using
import { MyComponent } from 'coollibrary';
but I can not use the following path:
import { MyComponent } from 'coollibrary/components'
Can I somehow achieve this behavior?
I generate library with following command:
ng generate coollibrary
and after build it with following command:
ng build --project coollibrary
My tsconfig:
...
"paths": {
"coollibrary": [
"dist/coollibrary"
],
"coollibrary/*": [
"dist/coollibrary/*"
]
}
...
来源:https://stackoverflow.com/questions/57532292/invalid-path-in-angular-library