balfonso
balfonso

Reputation: 631

Code breaks after using gulp-uglify : Ionic Framework

I'm just new to Ionicframework and new to using gulp. I am currently setting up my workflow and I use gulp-uglify to minify my app files. After using it the code breaks so I checked on the console and got this error.

Uncaught Error: [$injector:modulerr] Failed to instantiate module ebhealth due to: Error: [$injector:unpr] Unknown provider: t

I am using this gulp function to basically gather all js file from a specified location, concatenate them to all.js then uglify/minify.

gulp.task('app-scripts', function(){  
  return gulp.src(paths.scripts)
    .pipe(concat('all.js'))
    .pipe(uglify())
    .pipe(gulp.dest('www/app-dist/'));
});

After executing this command, I checked the all.js and indeed it looks minified and uglified but when I refresh the browser it throws an error. What am I doing wrong?

Upvotes: 0

Views: 496

Answers (1)

aorfevre
aorfevre

Reputation: 5064

add ng-annotate or format properly your injection with, for example ["$scope",function($scope){ }] instead of just function($scope)

its a common mistake / reuirement for angularJS minification / uglification

Upvotes: 1

Related Questions