Skip to content

Commit 32dda85

Browse files
committed
esm: fix return type of import.meta.resolve
PR-URL: nodejs/node#49698 Backport-PR-URL: nodejs/node#50669 Fixes: nodejs/node#49695 Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Guy Bedford <[email protected]>
1 parent f018cea commit 32dda85

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

graal-nodejs/lib/internal/errors.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ E('ERR_MISSING_ARGS',
14551455
E('ERR_MISSING_OPTION', '%s is required', TypeError);
14561456
E('ERR_MODULE_NOT_FOUND', function(path, base, exactUrl) {
14571457
if (exactUrl) {
1458-
lazyInternalUtil().setOwnProperty(this, 'url', exactUrl);
1458+
lazyInternalUtil().setOwnProperty(this, 'url', `${exactUrl}`);
14591459
}
14601460
return `Cannot find ${
14611461
exactUrl ? 'module' : 'package'} '${path}' imported from ${base}`;

graal-nodejs/test/es-module/test-esm-import-meta-resolve.mjs

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ const fixtures = dirname.slice(0, dirname.lastIndexOf('/', dirname.length - 2) +
99

1010
assert.strictEqual(import.meta.resolve('./test-esm-import-meta.mjs'),
1111
dirname + 'test-esm-import-meta.mjs');
12-
const notFound = import.meta.resolve('./notfound.mjs');
13-
assert.strictEqual(new URL(notFound).href, new URL('./notfound.mjs', import.meta.url).href);
14-
const noExtension = import.meta.resolve('./asset');
15-
assert.strictEqual(new URL(noExtension).href, new URL('./asset', import.meta.url).href);
12+
assert.strictEqual(import.meta.resolve('./notfound.mjs'), new URL('./notfound.mjs', import.meta.url).href);
13+
assert.strictEqual(import.meta.resolve('./asset'), new URL('./asset', import.meta.url).href);
1614
try {
1715
import.meta.resolve('does-not-exist');
1816
assert.fail();

0 commit comments

Comments
 (0)