summaryrefslogtreecommitdiff
path: root/ext/node/02_require.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/02_require.js')
-rw-r--r--ext/node/02_require.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/node/02_require.js b/ext/node/02_require.js
index f3ed266c3..578d8e873 100644
--- a/ext/node/02_require.js
+++ b/ext/node/02_require.js
@@ -98,7 +98,11 @@
}
function tryPackage(requestPath, exts, isMain, originalPath) {
- const pkg = core.ops.op_require_read_package_scope(requestPath).main;
+ const packageJsonPath = pathResolve(
+ requestPath,
+ "package.json",
+ );
+ const pkg = core.ops.op_require_read_package_scope(packageJsonPath).main;
if (!pkg) {
return tryExtensions(
pathResolve(requestPath, "index"),
@@ -135,12 +139,8 @@
err.requestPath = originalPath;
throw err;
} else {
- const jsonPath = pathResolve(
- requestPath,
- "package.json",
- );
node.globalThis.process.emitWarning(
- `Invalid 'main' field in '${jsonPath}' of '${pkg}'. ` +
+ `Invalid 'main' field in '${packageJsonPath}' of '${pkg}'. ` +
"Please either fix that or report it to the module author",
"DeprecationWarning",
"DEP0128",