Open dongzhouT opened 6 years ago
you can add declare var require: any
to src/typings.d.ts
, but it'll still fail when you try to build for production.
and there is no valid way for production / packaging? I am using ng-packagr to pack my modules and it fails because of this very unconvenient way with a require function inside forRoot:
ChartModule.forRoot(require('highcharts/highstock'))
this is my 'app.module.ts' imports: [ BrowserModule, FormsModule, ChartModule.forRoot(require('highcharts')) ], when i run 'ng serve',show the error->'ERROR in src/app/app.module.ts(71,25): error TS2304: Cannot find name 'require'.' How can I do to fix it?