Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

410
Vistas
Angular 4 - Error encountered resolving symbol values statically

One of my feature modules has this content:

declare function require(name: string);

@NgModule({
imports: [
// other modules here
ChartModule.forRoot(
  require('highcharts'),
  require('highcharts/highcharts-more'),
  require('highcharts/modules/funnel'),
  require('highcharts/modules/heatmap')
)

It runs fine locally but when I build it with the prod flag it fails. The error I get is:

ERROR in Error encountered resolving symbol values statically. Reference to a non-exported function (position 26 :18 in the original .ts file), resolving symbol ....

ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in ...

Any idea on how to resolve this?

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I can't point you to the exact line, because you didn't include the full @NgModule decorator. This fault is normally in the providers array, when you have something like this:

@NgModule({
// imports, exports and declarations
  providers: [{
    provide: XSRFStrategy, 
    useValue: new CookieXSRFStrategy('RESPONSE_TOKEN', 'RESPONSE_TOKEN') 
  }]
})
export class MyModule {}

You cannot use AOT when you have an inline function call like that. So instead, replace useValue with useFactory and an exported function (as stated in your error message).

Here is the AOT-safe version of my first listing:

export function xsrfFactory() {
  return new CookieXSRFStrategy('XSRF-TOKEN', 'X-XSRF-TOKEN');
}
@NgModule({
// imports, exports and declarations
  providers: [{
    provide: XSRFStrategy,
    useFactory: xsrfFactory
  }]
})
export class MyModule {}
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda