我使用eslint检查我的代码,出现了一个错误-- "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添加到之前,它发生了一个错误-- "error '_‘is not defined no-undef“。但是,当我向中添加lodash时,就像“‘lodash’:true”一样,.It不起作用。
你能帮帮我吗?
发布于 2017-09-08 00:03:04
ESLint不理解lodash库。您需要在您的配置中添加一个全局部分。
"globals":{ "_":true },
https://stackoverflow.com/questions/45317154
复制相似问题