We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1e181f4 commit c6656b8Copy full SHA for c6656b8
src/ModuleCache.js
@@ -17,8 +17,8 @@ export default class ModuleCache extends MapCache {
17
return;
18
}
19
const pkgPath = path.join(moduleRoot, 'package.json');
20
- const pkg = fs.existsSync(pkgPath) ? require(pkgPath) : { 'main': 'index.js' };
21
- const mainPath = normalizePath(path.dirname(path.resolve(moduleRoot, pkg.main)));
+ const pkgMain = fs.existsSync(pkgPath) && require(pkgPath).main || 'index.js';
+ const mainPath = normalizePath(path.dirname(path.resolve(moduleRoot, pkgMain)));
22
23
// Sort paths by the “main” entry first.
24
const dirPaths = _.orderBy(glob.sync(path.join(moduleRoot, '**/'), {
0 commit comments