diff options
author | Antoine du HAMEL <duhamelantoine1995@gmail.com> | 2020-05-03 13:04:59 +0300 |
---|---|---|
committer | Guy Bedford <guybedford@gmail.com> | 2020-05-16 05:08:39 +0300 |
commit | 985e9c5fe535e31fb26665dce7c0659b4ae61d21 (patch) | |
tree | 0e68d27a07db85dc436e91414ce73369044c2de6 /doc/api/errors.md | |
parent | 0f232ed69263874bae517b65fd79cb91ef1ed85e (diff) |
module: add specific error for dir import
PR-URL: https://github.com/nodejs/node/pull/33220
Fixes: https://github.com/nodejs/node/issues/33219
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Diffstat (limited to 'doc/api/errors.md')
-rw-r--r-- | doc/api/errors.md | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/api/errors.md b/doc/api/errors.md index a1746099343..e25b6d9d5c7 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -2045,6 +2045,20 @@ An attempt was made to load a module with an unknown or unsupported format. An invalid or unknown process signal was passed to an API expecting a valid signal (such as [`subprocess.kill()`][]). +<a id="ERR_UNSUPPORTED_DIR_IMPORT"></a> +### `ERR_UNSUPPORTED_DIR_IMPORT` + +`import` a directory URL is unsupported. Instead, you can +[self-reference a package using its name][] and [define a custom subpath][] in +the `"exports"` field of the `package.json` file. + +<!-- eslint-skip --> +```js +import './'; // unsupported +import './index.js'; // supported +import 'package-name'; // supported +``` + <a id="ERR_UNSUPPORTED_ESM_URL_SCHEME"></a> ### `ERR_UNSUPPORTED_ESM_URL_SCHEME` @@ -2604,3 +2618,5 @@ such as `process.stdout.on('data')`. [Subresource Integrity specification]: https://www.w3.org/TR/SRI/#the-integrity-attribute [try-catch]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch [vm]: vm.html +[self-reference a package using its name]: esm.html#esm_self_referencing_a_package_using_its_name +[define a custom subpath]: esm.html#esm_subpath_exports |