我的Webpack里有这么一个东西
output: {
path: path.resolve(__dirname, '/scripts'),
publicPath: '/scripts/FlightHotels',
filename: 'bundle.js'
},
但是ESlint总是抱怨我的__dirname属于未定义变量……有啥办法让他知道我的环境是nodeJS么?
这里放的warn
//.eslintrc.js
module.exports = {
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
...
"rules": {
"no-undef": 1, // http://eslint.org/docs/rules/no-undef
}
可不可以做这样的事情
var path = require('path'),
node = require('node');
//然后这样引用
path.resolve(node.__dirname, '/scripts'),
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
可以在某一行临时关闭提示,或者临时禁用某条rule 的,你找找文档。
搬运一个回答:http://stackoverflow.com/questions/27732...