没有定义meanjs grunt build jquery $

时间:2015-09-03 07:40:00

标签: jquery gruntjs meanjs

我开发了一个有点大的meanjs应用程序,当我运行grunt构建时,它给了我Jquery问题如下。

Weighted Activity Selection

我也使用了Jquery自调用方法,如下所示。但它也给我错误。

(function ($){
    $('#renew').modal('hide');
})(jQuery);

enter image description here

由于这些问题' public / dist / application.min.js'没有创造。

我可以看到jquery已经加载到浏览器中,如下所示。

enter image description here

1 个答案:

答案 0 :(得分:1)

我不认为这是一个错误。事实上,我认为这是jshint给出的警告,因为您使用'use strict';并且它不知道$已定义(在jquery文件中)。

您只需将$添加到globals文件中的.jshintrc,就像这样:

{
    "globals" : {
        "$": false
    }
}

或者将以下行添加到使用$

的所有js文件中
/*global $:false */

作为旁注,即使使用grunt --force警告,您也应该能够进行构建,但仍然应按照上述说明进行修复。