Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR in src/app/app.module.ts(71,25): error TS2304: Cannot find name 'require'. #249

Open
dongzhouT opened this issue Dec 27, 2017 · 2 comments

Comments

@dongzhouT
Copy link

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?

@gargantuanprism
Copy link

you can add declare var require: any to src/typings.d.ts, but it'll still fail when you try to build for production.

@fabian-hesse-swarco
Copy link

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'))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants