2017-07-26 646 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库。 您需要在您的配置中添加全局部分。

“全局”:{ “_”:真 },