I created a shared library with some components, pipes, directives etc.
One of the modules exports a pipe, that is in turn exported in public_api.ts
:
public_api.ts
[...]
export * from './lib/pipes/date/format/ob-date-format-pipe.module';
[...]
The module itself exports the pipe :
ob-date-format-pipe.module.ts
@NgModule({
imports: [
CommonModule,
],
declarations: [
ObDateFormatPipe,
],
exports: [
ObDateFormatPipe,
],
})
export class ObDateFormatPipeModule { }
This seems pretty standard.
Problem : when I create a version of this library, I can use the pipe but only from HTML ! If I try to import the pipe from TypeScript, the import ObDateFormatPipe from "@acme/framework"
will not be resolved.
If I want it to work, I have to explicitly export the pipe, even if it is already exported from the module, like this :
[...]
export * from './lib/pipes/date/format/ob-date-format-pipe.module';
export { ObDateFormatPipe } from './lib/pipes/date/format/ob-date-format.pipe';
[...]
Is it normal or did I do something wrong ? Anything special with pipes ?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…