I use uglify with grunt, and for some reason it throws a warning on my app file:
Warning: Uglification failed. Unexpected token: eof (undefined). Line 15472 in dist/app.annotated.js Use --force to continue.
This is the file with lines:
15469 $scope.selectLocation = function () {
15470 $("#locationIframe").html('');
15471 if (($scope.LeadObj.address1 == "" || $scope.LeadObj.address1 == null) && $scope.LeadObj.ip != null) {
15472 $scope.showLocation = 'loading';
15473 $.ajax({
15474 type: 'GET',
Besides the fact that this code is stupid, why do I get this warning? it all checks out..
As suggested in the comments, the problem was with how the lines ended. Not all of them ended in the UNIX style of \n
.
The solution was to use grunt-lineending
to convert the file to use correct line endings before uglifying.
lineending: {
dist: {
options: {
overwrite: true,
eol: 'lf'
},
files: {
'': ['dist/**/*.js']
}
}
},