Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/internal/modules/esm')
-rw-r--r--lib/internal/modules/esm/get_source.js3
-rw-r--r--lib/internal/modules/esm/resolve.js15
2 files changed, 7 insertions, 11 deletions
diff --git a/lib/internal/modules/esm/get_source.js b/lib/internal/modules/esm/get_source.js
index 18af566df90..7b2a2f42eab 100644
--- a/lib/internal/modules/esm/get_source.js
+++ b/lib/internal/modules/esm/get_source.js
@@ -28,8 +28,7 @@ async function defaultGetSource(url, { format } = {}, defaultGetSource) {
return {
source: Buffer.from(body, base64 ? 'base64' : 'utf8')
};
- } else {
- throw new ERR_INVALID_URL_SCHEME(['file', 'data']);
}
+ throw new ERR_INVALID_URL_SCHEME(['file', 'data']);
}
exports.defaultGetSource = defaultGetSource;
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
index cbcdb020ed7..29235a6785f 100644
--- a/lib/internal/modules/esm/resolve.js
+++ b/lib/internal/modules/esm/resolve.js
@@ -455,10 +455,9 @@ function packageMainResolve(packageJSONUrl, packageConfig, base, conditions) {
if (packageConfig.main !== undefined) {
return finalizeResolution(
new URL(packageConfig.main, packageJSONUrl), base);
- } else {
- return finalizeResolution(
- new URL('index', packageJSONUrl), base);
}
+ return finalizeResolution(
+ new URL('index', packageJSONUrl), base);
}
return legacyMainResolve(packageJSONUrl, packageConfig);
}
@@ -578,10 +577,9 @@ function packageResolve(specifier, base, conditions) {
} else if (packageSubpath === '') {
return packageMainResolve(packageJSONUrl, packageConfig, base,
conditions);
- } else {
- return packageExportsResolve(
- packageJSONUrl, packageSubpath, packageConfig, base, conditions);
}
+ return packageExportsResolve(
+ packageJSONUrl, packageSubpath, packageConfig, base, conditions);
}
}
@@ -611,10 +609,9 @@ function packageResolve(specifier, base, conditions) {
} else if (packageConfig.exports !== undefined) {
return packageExportsResolve(
packageJSONUrl, packageSubpath, packageConfig, base, conditions);
- } else {
- return finalizeResolution(
- new URL(packageSubpath, packageJSONUrl), base);
}
+ return finalizeResolution(
+ new URL(packageSubpath, packageJSONUrl), base);
// Cross-platform root check.
} while (packageJSONPath.length !== lastPath.length);