Function expressions are not supported in decorators
In my case error was caused by:
export const listAnimation = ()...
instead of:
export function listAnimation()...
You need to refactor code like this:
{
provide: APP_INITIALIZER,
useFactory: loadStuff,
deps: [InitRolesService],
multi: true
}
and then export function
export function loadStuff(service: InitService) {
return () => service.load().subscribe(data => { ... }));
}
As your error says, you need to export the function. Decorators don't accept function calls into their properties.
You can find more information on this github issue : https://github.com/angular/angular/issues/15587