Kagami / gulp-ng-annotate

:pushpin: Add angularjs dependency injection annotations with ng-annotate

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem when $inject is already defined twice

ersimont opened this issue · comments

I'm still a bit of a gulp noob, so forgive me if I don't know what I'm talking about.

I had some silly code that defined $inject for a directive's controller twice (oops!). The only behavior I saw, though, was that when I added ngAnnotate() to my gulpfile suddenly everything stopped working, without any error message. I added/removed files from my build process to narrow it down, then comment/uncomment code until I found the issue.

I first filed this ticket with ng-annotate itself (olov/ng-annotate#192). Olov says it reports the error message below, so the bug must be here. Unless I have to do something special to actually see error messages?

~/projects/ng-annotate/tests-issues % ng-annotate -a issue192.js
error: conflicting inject arrays at line 3 and 7

I get the expected error with your provided example and simplest gulp task:

$ cat gulpfile.js 
var gulp = require('gulp');
var ngAnnotate = require('gulp-ng-annotate');

gulp.task('default', function() {
  return gulp.src('issue192.js').pipe(ngAnnotate());
});
$ gulp           
[19:49:08] Using gulpfile ~/code/tmp/node/gan/gulpfile.js
[19:49:08] Starting 'default'...
[19:49:08] 'default' errored after 32 ms
[19:49:08] Error in plugin 'gulp-ng-annotate'
Message:
    issue192.js: error: conflicting inject arrays at line 3 and 7
$ echo $?
1

Probably there is an error in your gulpfile. Try to simplify it, remove everything except the basic compile steps.

Closing because of no activity. Feel free to provide additional feedback if something is still unclear.

I finally got back around to trying to recreate this problem, and I cannot. :( My gulpfile has changed a lot since then, so I assume there is some magic combination/order I was using then to produce this issue. Sorry to have wasted your time.

No problem. If you reproduce it again, feel free to comment here.