Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

143
Visualizações
Importing Plotly module to Angular breaks application

I have used npm to install angular-plotly.js according to its documentation (https://github.com/plotly/angular-plotly.js/blob/master/README.md) as follows:

npm install angular-plotly.js plotly.js-dist-min --save
npm install @types/plotly.js-dist-min --save-dev

When I go into my main app component, I include the following code:

import { NgModule } from '@angular/core';
...
import * as PlotlyJS from 'plotly.js-dist-min';
import { PlotlyModule } from 'angular-plotly.js';

PlotlyModule.plotlyjs = PlotlyJS;

@NgModule({
  declarations: [
    AppComponent,
    ...
  ],
  imports: [
    ...,
    PlotlyModule
  ],
  providers: [
    ...
  ],
  bootstrap: [AppComponent],
})

export class AppModule { }

Now, when I ng serve --open my app (which is Angular 13.x), I get the following errors:

core.mjs:4032 JIT compilation failed for NgModule class AppModule {
}
getCompilerFacade @ core.mjs:4032
get @ core.mjs:23727
getNgModuleDef @ core.mjs:1128
assertNgModuleType @ core.mjs:1297
compileNgModuleFactory @ core.mjs:25796
bootstrapModule @ core.mjs:26047
14431 @ main.ts:11
__webpack_require__ @ bootstrap:19
__webpack_exec__ @ main.ts:12
(anonymous) @ main.ts:12
__webpack_require__.O @ chunk loaded:23
(anonymous) @ main.ts:12
webpackJsonpCallback @ jsonp chunk loading:71
(anonymous) @ main.js:2
core.mjs:4051 Uncaught Error: The NgModule 'AppModule' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available.

JIT compilation is discouraged for production use-cases! Consider using AOT mode instead.
Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',
or manually provide the compiler with 'import "@angular/compiler";' before bootstrapping.
    at getCompilerFacade (core.mjs:4051:1)
    at AppModule.get (core.mjs:23727:1)
    at getNgModuleDef (core.mjs:1128:1)
    at assertNgModuleType (core.mjs:1297:1)
    at compileNgModuleFactory (core.mjs:25796:1)
    at PlatformRef.bootstrapModule (core.mjs:26047:1)
    at 14431 (main.ts:11:26)
    at __webpack_require__ (bootstrap:19:1)
    at __webpack_exec__ (main.ts:12:37)
    at main.ts:12:37

Thus far I have been able to successfully troubleshoot this issue. Does anyone know how to resolve this?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda