0

I'm trying to build my angular5 proj but it fails.


This is an excerpt of deps tree:

simple-kaishi <- kaishi <- ngx-admin-lte


ngx-admin-lte: (develop branch) is the angular version of popular adminlte theme

kaishi : (master branch) is a my core-library that includes ngx-admin-lte and adds other core features.

simple-kaishi : (master branch) is my sample project that includes kaishi


To reproduce:

  1. clone kaishi
  2. kaishi> npm install
  3. kaishi> npm run packagrto package kaishi as a feature library
  4. clone simple-kaishi
  5. simple-kaishi> npm install
  6. simple-kaishi> npm link ../kaishi/dist
  7. simple-kaishi> npm start it should be ok
  8. simple-kaishi> npm run build build fails!

Build error is

ERROR in : Unexpected value 'undefined' declared by the module 'NgxAdminLteModule in /git/simple-kaishi/node_modules/kaishi/node_modules/ngx-admin-lte/ngx-admin-lte.d.ts'

What's the matter?


-- details --

my ng -- version

Angular CLI: 1.7.3
Node: 8.10.0
OS: win32 x64
Angular: 5.2.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.3
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2


+++ UPDATE +++

I've noticed that problem arises for ng build --prod but not for ng build. My proj structure is not the cause, but the cause is around the external lib ngx-admin-lte

Fabio Formosa
  • 904
  • 8
  • 27

1 Answers1

1

Finally I got it!

Problem was in AOT compiling option. Indeed, npm run build launches ng --prod that's a shortcut for --AOT=true. ngx-admin-lte lib had a bug.

This comment helped me to solve. In main ts file, it needs to replace all following imports like this:
import { LogoComponent } from './widgets/logo'
with:
import { LogoComponent } from './widgets/logo.component'

I've pushed a PR to ngx-admin-lte and Library has been fixed.
My project structure is OK.
If this can be useful, looking for AOT compiler problem if you get an error similar to this.

Fabio Formosa
  • 904
  • 8
  • 27