TwanoO67 / ngx-admin-lte

Admin LTE for Angular 2/4/6/8 as a NPM package
MIT License
108 stars 47 forks source link

Unexpected value 'undefined' declared by the module 'NgxAdminLteModule in ngx-admin-lte/ngx-admin-lte.d.ts' #63

Closed fabioformosa closed 6 years ago

fabioformosa commented 6 years ago

I'm trying to build my proj that includes ngx-admin-lte

ng build --prod

and I get the following error: ERROR in : Unexpected value 'undefined' declared by the module 'NgxAdminLteModule in simple-kaishi/node_modules/kaishi/node_modules/ngx-admin-lte/ngx-admin-lte.d.ts'

why?

TwanoO67 commented 6 years ago

Hello,

which version of ngx-admin-lte did you installed?

fabioformosa commented 6 years ago

2.0.0-beta.10

TwanoO67 commented 6 years ago

and what is your "ng --version" ?

TwanoO67 commented 6 years ago

I tried with this package.json here: https://github.com/TwanoO67/bootstraping-ngx-admin-lte/blob/develop/package.json

And the problem doesn't seem to appear, so I suppose it's related to some dependencies versions

fabioformosa commented 6 years ago

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

I'm able to build bootstraping-ngx-admin-lte but not this simple-kaishi that includes ngx-admin-lte and kaishi that includes ngx-admin-lte too.

TwanoO67 commented 6 years ago

Are you on the "develop" branche of bootstraping-ngx-admin-lte ? because the 'master' branche is still on ngx-admin-lte v1

TwanoO67 commented 6 years ago

And the "develop" branch, use the new "@angular/cli": "~6.0.0-beta.5"

fabioformosa commented 6 years ago

bootstraping-ngx-admin-lte is ok... it's build fine. But I'm not using it, I'm using ngx-admin-lte.

My error is when I try to build a project (simple-kaishi) that uses a core library (kaishi) that uses ngx-admin-lte.

  1. bootstraping-ngx-admin-lte -> ngx-admin-lte
  2. simple-kaishi -> kaishi -> ngx-admin-lte

I'm in the case 2, not in case 1. I don't understand why build fails due to ngx-admin-lte if there is a third level in the project structure.

if you want reproduce:

  1. clone kaishi
  2. kaishi> npm install
  3. kaishi>npm run packagr
  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!
TwanoO67 commented 6 years ago

As said it's seems to be related to a sub dependencies.

Try updating to new @angular/cli

Also look if you have a different version installed in your projet and globally on your computer.

fabioformosa commented 6 years ago

latest version in both.

fabioformosa commented 6 years ago

@TwanoO67 , I get the same error also in bootstraping-ngx-admin-lte. Could you try to run npm run prod? Let's me know.

The error, for me, is: ERROR in : Unexpected value 'undefined' declared by the module 'NgxAdminLteModule in git/bootstraping-ngx-admin-lte/node_modules/ngx-admin-lte/ngx-admin-lte.d.ts'

catull commented 6 years ago

@TwanoO67 Can you at least roll another beta version ? I am eagerly anticipating the fix for AOT which Fabio solved.

@fabioformosa With ng 1.7.3 and 1.7.4 you still need to build this way to work around the error you mention:
ng build --target production --sourcemaps false --aot false

You can leave out sourcemaps, but you have to force non-AOT mode.

Good luck!

catull commented 6 years ago

@TwanoO67 It is not an option to use beta version for production systems. I am referring to using ng CLI 6.0.0-beta.

fabioformosa commented 6 years ago

@catull I've just tried ngx-admin-lte 2.0.0-beta11 in my proj and I can confirm now I successfull build it with --prod option (that's --aot=true) and ng CLI 1.7.3. @TwanoO67 thank you for release. I'm going to close this issue.