He usado npm para instalar angular-plotly.js acuerdo con su documentación ( https://github.com/plotly/angular-plotly.js/blob/master/README.md ) de la siguiente manera:
npm install angular-plotly.js plotly.js-dist-min --save npm install @types/plotly.js-dist-min --save-devCuando entro en el componente principal de mi aplicación, incluyo el siguiente código:
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 { } Ahora, cuando hago ng serve --open my app (que es Angular 13.x ), obtengo los siguientes errores:
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:37Hasta ahora he podido solucionar con éxito este problema. ¿Alguien sabe cómo resolver esto?