Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ngAnnotate - Warning: StringMap expected string key

Tags:

I get this warning when using Grunt and grunt-ng-annotate.

There is no reference in the warning to where the error is in the file, which makes debugging it hard.

Any ideas?

like image 668
iss42 Avatar asked Aug 31 '17 11:08

iss42


2 Answers

The issue turned out to be use of ES6 notation, in this case arrow functions (=>), default parameters and let.

I haven't looked in detail as to why ngAnnotate doesn't support this.

To find where the issues were I overrode the ngAnnotate warning with grunt switch --force and later in the build uglify complained about the ES6 syntax with more detail.

like image 168
iss42 Avatar answered Sep 24 '22 15:09

iss42


Possible reasons:

  • () => {}
  • { value }
  • let
  • function (...args)
  • function (defaultVar = false)

Solutions:

  • function () {}
  • { value: value }
  • var
  • function (args)
  • function (defaultVar) { defaultVar = (defaultVar === undefined) ? false : defaultVar }
like image 24
D. H. Avatar answered Sep 23 '22 15:09

D. H.