lodash / babel-plugin-lodash

Modular Lodash builds without the hassle.
Other
1.96k stars 91 forks source link

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

Open CHENJIAMIAN opened 2 years ago

CHENJIAMIAN commented 2 years ago
Error at  //if (!module.get(base).has(lower))
resolvePath (D:\Desktop\xxxx\node_modules\_babel-plugin-lodash@3.3.4@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/_babel-plugin-lodash@3.3.4@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/_lodash@4.17.21@lodash/**/', {
    'ignore': 'D:/Desktop/xxxx/node_modules/_lodash@4.17.21@lodash/node_modules/**/'
})

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

//node_modules/_glob@7.2.2@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\\_lodash@4.17.21@lodash\\node_modules\\**\\', nonegate: true, nocomment: true, allowWindowsEscape: true}
    //pattern:'D:\\Desktop\\xxxx\\node_modules\\_lodash@4.17.21@lodash\\**\\'