2017-07-26 647 views
0

我使用eslint來檢查我的代碼,併發生錯誤 - 「錯誤'_'未定義no-undef」。error'_'is not defined no-undef

我寫這樣的代碼:這樣

new webpack.ProvidePlugin({ 
    $: "jquery",//jquery 
    jQuery: "jquery", 
    "window.jQuery": "jquery", 
    _:"lodash"//lodash 
}) 

,並得到.eslintrc.js,部分是:

"env": { 
    "browser": true, 
    "commonjs": true, 
    "es6": true, 
    "jquery":true, 
}, 

之前,我添加了jQuery到,它發生的錯誤 - - 「錯誤'_'未定義爲no-undef」。 但是,當我添加lodash時,就像那樣「'lodash':真」。它不起作用。

你能幫我嗎?

回答

1

ESLint不理解lodash庫。 您需要在您的配置中添加全局部分。

「全局」:{ 「_」:真 },