babel-plugin-lodash icon indicating copy to clipboard operation
babel-plugin-lodash copied to clipboard

Error: "Cannot read property 'has' of undefined" after glob update v7.2.0 to v7.2.2

Open CHENJIAMIAN opened this issue 2 years ago • 0 comments

Error at  //if (!module.get(base).has(lower))
resolvePath (D:\Desktop\xxxx\node_modules\[email protected]@babel-plugin-lodash\lib\importModule.js:22:24)

That is Why

After dependency glob update v7.2.0 to v7.2.2, the common.js of glob added 'options.allowWindowsEscape = true',

//node_modules/[email protected]@babel-plugin-lodash/lib/ModuleCache.js

//var dirPaths = (0, _orderBy2.default)(_glob.default.sync(_path.default.join(moduleRoot, '**/'), {
//      'ignore': _path.default.join(moduleRoot, 'node_modules/**/')
//    }), function (dirPath) {
//      return (0, _startsWith2.default)(dirPath, mainPath);
//    }, ['desc']);

//in my case:
glob.sync('D:/Desktop/xxxx/node_modules/[email protected]@lodash/**/', {
    'ignore': 'D:/Desktop/xxxx/node_modules/[email protected]@lodash/node_modules/**/'
})

//node_modules/[email protected]@glob/common.js
self.minimatch=new Minimatch(pattern, options) //self.minimatch=(7)['D:', 'Desktop', 'xxxx', 'node_modules', '[email protected]@lodash', {…}, '']
    //options:{ignore: 'D:\\Desktop\\xxxx\\node_modules\\[email protected]@lodash\\node_modules\\**\\', nonegate: true, nocomment: true}
    //pattern:'D:\\Desktop\\xxxx\\node_modules\\[email protected]@lodash\\**\\'

//node_modules/[email protected]@glob/common.js
self.minimatch=new Minimatch(pattern, options) // self.minimatch=(1)[/^(?=.)D:Desktopxxxxnode_modules_lodash\\@4\\.17\\.21\\@lodash\\*[^/]*?\\\\$/]
    //options:{ignore: 'D:\\Desktop\\xxxx\\nod…ules\\[email protected]@lodash\\node_modules\\**\\', nonegate: true, nocomment: true, allowWindowsEscape: true}
    //pattern:'D:\\Desktop\\xxxx\\node_modules\\[email protected]@lodash\\**\\'

CHENJIAMIAN avatar May 14 '22 14:05 CHENJIAMIAN