Repository: ng-packagr/ng-packagr

Issue #917: AOT: Unexpected value 'undefined' exported by the module when using barrel index.ts
Created: 2018-06-01T19:37:06Z
Type of Issue
[x] Bug Report
[ ] Feature Request

Description
I'm trying to migrate an existing library to the new Angular-cli library support
This library has a lot of barrels index.ts files
I'm experiencing error on build with AOT enabled
How To Reproduce
https://github.com/kepennar/ng-cli-lib-issue-repro
Given a library managed by the new angular-cli v6 library management system.
Given a component Comp1Component of this lib imported from a barrel index.ts in a module LibModule
projects/lib1/src/lib/components/index.ts
export * from './comp1.component';
projects/lib1/src/lib/lib.module.ts
import { Comp1Component } from './components';
// ...

@NgModule({
  declarations: [Comp1Component],
  exports: [Comp1Component]
})
export class LibModule {}
When an application using this lib is launched in prod mode
Then build crash with the error
ERROR in : Unexpected value 'undefined' exported by the module 'Lib1Module ...

If the component is directly imported from it's own file. It's work
projects/lib1/src/lib/lib.module.ts
import { Comp1Component } from './components/comp1.component';
@NgModule({
  declarations: [Comp1Component],
  exports: [Comp1Component]
})
export class LibModule {}
Reproduction steps
From the repo https://github.com/kepennar/ng-cli-lib-issue-repro
npm run build:lib
npm run start:prod
Expected Behaviour
I would like ng-packagr to support correctly barrels files
Version Information
Output from: ng --version.
Angular CLI: 6.0.7
Node: 10.3.0
OS: linux x64
Angular: 6.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.6.7
@angular-devkit/build-angular      0.6.7
@angular-devkit/build-ng-packagr   0.6.7
@angular-devkit/build-optimizer    0.6.7
@angular-devkit/core               0.6.7
@angular-devkit/schematics         0.6.7
@angular/cli                       6.0.7
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.0.7
@schematics/angular                0.6.7
@schematics/update                 0.6.7
ng-packagr                         3.0.0
rxjs                               6.2.0
typescript                         2.7.2
webpack                            4.8.3

Duplicate issue #943: [Bug] libraries dependencies using index.ts
Created: 2018-06-13T06:31:44Z
Type of Issue
[x] Bug Report
[ ] Feature Request

Description
I thinks it's a angular-cli issue, but what do I know :)
I posted it there and here as well: angular/angular-cli#11210
Here is project: https://github.com/piernik/lib-deps-bug
It contains two libraries. Second is dependent on First. Build first lib using npm run first:build, then build second using npm run second:build - it fails.
Now go to https://github.com/piernik/lib-deps-bug/blob/master/projects/first/src/lib/first.module.ts and comment in import {MyPipePipe} from './pipes'; and comment out // import {MyPipePipe} from './pipes/my-pipe/my-pipe.pipe';
It is working now.
Expected Behaviour
Pipes folder is exported as a whole with index.ts so it should work.
Version Information
In project I use "ng-packagr": "^3.0.0-rc.2", that comes with angular-cli but also tried 3.0.1 this the same result.

Closing comment (2018-06-13T08:15:46Z): Duplicate of #917