bare-module-resolve
Advanced tools
Comparing version
16
index.js
@@ -152,3 +152,3 @@ const errors = require('./lib/errors') | ||
if (packageSubpath === '.') { | ||
if (typeof info.main === 'string') { | ||
if (typeof info.main === 'string' && info.main) { | ||
packageSubpath = info.main | ||
@@ -166,3 +166,11 @@ } else { | ||
if (yield * exports.file(packageSubpath + '/index', packageURL, false, opts)) { | ||
let packageIndex | ||
if (packageSubpath[packageSubpath.length - 1] === '/') { | ||
packageIndex = packageSubpath + 'index' | ||
} else { | ||
packageIndex = packageSubpath + '/index' | ||
} | ||
if (yield * exports.file(packageIndex, packageURL, false, opts)) { | ||
yielded = true | ||
@@ -376,3 +384,3 @@ } | ||
exports.directory = function * (dirname, parentURL, opts) { | ||
parentURL = new URL(dirname === '/' ? dirname : dirname + '/', parentURL) | ||
parentURL = new URL(dirname[dirname.length - 1] === '/' ? dirname : dirname + '/', parentURL) | ||
@@ -386,3 +394,3 @@ const info = yield pkg(new URL('package.json', parentURL)) | ||
if (typeof info.main === 'string') { | ||
if (typeof info.main === 'string' && info.main) { | ||
let yielded = false | ||
@@ -389,0 +397,0 @@ |
{ | ||
"name": "bare-module-resolve", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"description": "Low-level module resolution algorithm for Bare", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
24259
1%329
1.86%