x)- [X ] bug report -> please search for issues before submitting
- [ ] feature request
keycloak-angular 2.0.0
Angular 5.2
Download and install @2.0.0
Add keycloak module
Add init
run build and note error:
import { BrowserModule } from '@angular/platform-browser';
import {APP_INITIALIZER, NgModule} from '@angular/core';
import { AppComponent } from './app.component';
import { TreasureComponent } from './treasure/treasure.component';
import { LandingComponent } from './landing/landing.component';
import {appRoutes} from './app.routes';
import {HttpClientModule} from '@angular/common/http';
import {KeycloakAngularModule, KeycloakService} from 'keycloak-angular';
import {initializer} from './init';
@NgModule({
declarations: [
AppComponent,
TreasureComponent,
LandingComponent
],
imports: [
appRoutes,
BrowserModule,
HttpClientModule,
KeycloakAngularModule
],
providers: [
{
provide: APP_INITIALIZER,
useFactory: initializer,
multi: true,
deps: [KeycloakService]
}
],
bootstrap: [AppComponent]
})
export class AppModule { }
./init.ts
import {KeycloakService} from 'keycloak-angular';
export function initializer(keycloak: KeycloakService): () => Promise<any> {
return (): Promise<any> => {
return new Promise(async (resolve, reject) => {
try {
await keycloak.init();
resolve();
} catch (error) {
reject(error);
}
});
};
}
Next:
ng build --prod --aot=true
Date: 2018-05-22T18:37:13.094Z
Hash: 945915fac13ecc0872fa
Time: 2448ms
chunk {0} styles.ac89bfdd6de82636b768.bundle.css (styles) 0 bytes [initial] [rendered]
chunk {1} polyfills.997d8cc03812de50ae67.bundle.js (polyfills) 84 bytes [initial] [rendered]
chunk {2} main.ee32620ecd1edff94184.bundle.js (main) 84 bytes [initial] [rendered]
chunk {3} inline.318b50c57b4eba3d437b.bundle.js (inline) 796 bytes [entry] [rendered]
ERROR in : Encountered undefined provider! Usually this means you have a circular dependencies (might be caused by using 'barrel' index.ts files.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @fish/[email protected] build: `ng build --prod --aot=true`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @fish/[email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jmurphy/.npm/_logs/2018-05-22T18_37_13_120Z-debug.log
Expected: AOT should work
I am experiencing this issue as well.
Facing the same issue.
Just adding the following line to a fresh angular app is enough to break AOT.
import { KeycloakAngularModule } from 'keycloak-angular';
I can confirm this.
I looked inside the code really quick. I cannot find were the problem is. I will try to have another look when I have more time.
ERROR in : Encountered undefined provider! Usually this means you have a circular dependencies (might be caused by using 'barrel' index.ts files.
Confirm same issue with:
keycloak-angular 3.0.0
Angular 6.0.0
Hi, I'm working on this issue.
@rightisleft, thanks for reporting.
New versions released. All tested and working with aot.
Thanks everybody!
Most helpful comment
New versions released. All tested and working with aot.
Thanks everybody!