Tampa
Tampa

Reputation: 78254

angular2 version 4.0.1 - Cannot find name 'require'

This worked in angular2... 2.x

imports: [
....
ChartModule.forRoot(require('highcharts'))
]

In an angular2 4.0.1

Failed to compile.

/Users/angular2isstupid/Documents/frontend/ang4test/src/app/app.module.ts (44,25): Cannot find name 'require'.

How do I deal with these changes?

Upvotes: 1

Views: 707

Answers (1)

Sergnio
Sergnio

Reputation: 167

Try adding

declare var require: any;

to your src/typings.d.ts file.

Upvotes: 4

Related Questions