Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/internal/modules/esm/initialize_import_meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function createImportMetaResolve(defaultParentURL, loader, allowParentURL) {
case 'ERR_MODULE_NOT_FOUND':
({ url } = error);
if (url) {
return url;
return `${url}`;
}
}
throw error;
Expand Down
6 changes: 2 additions & 4 deletions test/es-module/test-esm-import-meta-resolve.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ const fixtures = dirname.slice(0, dirname.lastIndexOf('/', dirname.length - 2) +

assert.strictEqual(import.meta.resolve('./test-esm-import-meta.mjs'),
dirname + 'test-esm-import-meta.mjs');
const notFound = import.meta.resolve('./notfound.mjs');
assert.strictEqual(new URL(notFound).href, new URL('./notfound.mjs', import.meta.url).href);
const noExtension = import.meta.resolve('./asset');
assert.strictEqual(new URL(noExtension).href, new URL('./asset', import.meta.url).href);
assert.strictEqual(import.meta.resolve('./notfound.mjs'), new URL('./notfound.mjs', import.meta.url).href);
assert.strictEqual(import.meta.resolve('./asset'), new URL('./asset', import.meta.url).href);
try {
import.meta.resolve('does-not-exist');
assert.fail();
Expand Down