We try to create a components library. These components are mainly wrappers around ng-lightning
components.
We generated the lib project using Angular CLI.
The fact is we encounter errors when building the lib: Cannot determine the module for class NglBadge in /testApp/node_modules/ng-lightning/badges/badge.d.ts!
This error occurs for every single component of ng-lightning
.
Here is how we imported ng-lightning in our library module:
import { NgModule } from '@angular/core';
import { SomeLibComponent } from './some-lib.component';
import { NglModule } from 'ng-lightning/ng-lightning';
@NgModule({
imports: [
NglModule.forRoot(),
],
declarations: [SomeLibComponent],
exports: [SomeLibComponent]
})
export class SomeLibModule { }
There is SomeLibComponent:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'lib-some-lib',
template: `
<ngl-badge type="default">Default</ngl-badge>
`,
styles: []
})
export class SomeLibComponent {
constructor() { }
}
What can I do from our library side to be able to use ng-lightning in our components?
It seems like an AOT error but I cannot find a way to use some third party library components/modules within our lib without triggering errors.
Here is a repro repository. It's quite difficult to put it on stackblitz or other since they doesn't offer the lib build.
https://github.com/blackholegalaxy/lightning-lib-error/blob/master/projects/some-lib/src