From 261420375f28459cac46fbc36c9d8e626f90e5ae Mon Sep 17 00:00:00 2001 From: Kevin Locke Date: Fri, 7 May 2021 10:40:13 -0600 Subject: [PATCH] doc: drop import.meta.resolve parent arg URL type I could not find any version of Node.js which accepts a parent URL argument. For example, on Node.js 16.1.0, index.mjs with content: ```js import.meta.resolve('./index.mjs', new URL(import.meta.url)); ``` produces: node:internal/process/promises:246 triggerUncaughtException(err, true /* fromPromise */); ^ TypeError [ERR_INVALID_ARG_TYPE]: The "parentURL" argument must be of type string. Received an instance of URL at new NodeError (node:internal/errors:363:5) at validateString (node:internal/validators:119:11) at Loader.resolve (node:internal/modules/esm/loader:87:7) at Object.resolve (node:internal/modules/esm/translators:122:26) at file:///path/to/index.mjs:1:13 at ModuleJob.run (node:internal/modules/esm/module_job:175:25) at async Loader.import (node:internal/modules/esm/loader:178:24) at async Object.loadESM (node:internal/process/esm_loader:68:5) { code: 'ERR_INVALID_ARG_TYPE' } Therefore, update the docs to drop the URL type for this argument. Signed-off-by: Kevin Locke --- doc/api/esm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/esm.md b/doc/api/esm.md index 4787dfc74da92d..84fded5ee8cfa9 100644 --- a/doc/api/esm.md +++ b/doc/api/esm.md @@ -287,7 +287,7 @@ This feature is only available with the `--experimental-import-meta-resolve` command flag enabled. * `specifier` {string} The module specifier to resolve relative to `parent`. -* `parent` {string|URL} The absolute parent module URL to resolve from. If none +* `parent` {string} The absolute parent module URL to resolve from. If none is specified, the value of `import.meta.url` is used as the default. * Returns: {Promise}