Invalid path in Angular library

对着背影说爱祢 提交于 2019-12-23 04:34:51

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!