我使用uglify和grunt,并且由于某种原因它会在我的app文件上发出警告:
警告:丑化失败。意外的令牌:eof(未定义)。线 15472 in dist / app.annotated.js使用--force继续。
这是带有行的文件:
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',
除了这段代码是愚蠢的,为什么我会收到这个警告?一切都结束了..
答案 0 :(得分:1)
正如评论中所建议的,问题在于线条是如何结束的。并非所有这些都以\n
的UNIX样式结束。
解决方案是使用grunt-lineending
将文件转换为在uglifying之前使用正确的行结尾。
lineending: {
dist: {
options: {
overwrite: true,
eol: 'lf'
},
files: {
'': ['dist/**/*.js']
}
}
},