GeezerVison is showing github.com — esm: fix return type of `import.meta.resolve` · nodejs/node@46d730a
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/internal/errors.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -1455,7 +1455,7 @@ E('ERR_MISSING_ARGS', |
1455 | 1455 | E('ERR_MISSING_OPTION', '%s is required', TypeError); |
1456 | 1456 | E('ERR_MODULE_NOT_FOUND', function(path, base, exactUrl) { |
1457 | 1457 | if (exactUrl) { |
1458 | | - lazyInternalUtil().setOwnProperty(this, 'url', exactUrl); |
| 1458 | + lazyInternalUtil().setOwnProperty(this, 'url', `${exactUrl}`); |
1459 | 1459 | } |
1460 | 1460 | return `Cannot find ${ |
1461 | 1461 | exactUrl ? 'module' : 'package'} '${path}' imported from ${base}`; |
|
Collapse file
Copy file name to clipboardExpand all lines: test/es-module/test-esm-import-meta-resolve.mjs +2-4Lines changed: 2 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -9,10 +9,8 @@ const fixtures = dirname.slice(0, dirname.lastIndexOf('/', dirname.length - 2) + |
9 | 9 |
|
10 | 10 | assert.strictEqual(import.meta.resolve('./test-esm-import-meta.mjs'), |
11 | 11 | 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); |
16 | 14 | try { |
17 | 15 | import.meta.resolve('does-not-exist'); |
18 | 16 | assert.fail(); |
|