Skip to content

Commit 6d08545

Browse files
committed
fix: only recover missing main, not broken package.json
1 parent e3085c5 commit 6d08545

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/package-reader.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ export default class PackageReader {
2424
this.version = metadata.version || 'N/A';
2525
this.browserReplacement = _browserReplacement(metadata.browser);
2626
})
27-
.then(() => this._nodejsLoadAsDirectory(''))
2827
// when main file is missing, falls back to default index.js
29-
.catch(() => 'index.js')
28+
.then(() => this._nodejsLoadAsDirectory('').catch(() => 'index.js'))
3029
.then(mainPath => {
3130
const replacement = this.browserReplacement['./' + stripJsExtension(mainPath)];
3231
if (replacement) {

0 commit comments

Comments
 (0)