summaryrefslogtreecommitdiff
path: root/doc/api/deprecations.md
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-03-20 17:00:57 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2019-03-27 17:11:53 +0100
commit115f0f5a57f50f6b039f28a56910207f92df116d (patch)
treeb8937769e8c49b2a51b4ed7772e6bafc2657a14a /doc/api/deprecations.md
parent7bddfcc61a5a7d04583a8c4fec462ca5ce45b677 (diff)
downloadandroid-node-v8-115f0f5a57f50f6b039f28a56910207f92df116d.tar.gz
android-node-v8-115f0f5a57f50f6b039f28a56910207f92df116d.tar.bz2
android-node-v8-115f0f5a57f50f6b039f28a56910207f92df116d.zip
module: throw an error for invalid package.json main entries
We currently ignore invalid `main` entries in package.json files. This does not seem to be very user friendly as it's certainly an error if the `main` entry is not a valid file name. So instead of trying to resolve the file otherwise, throw an error immediately to improve the user experience. To keep it backwards compatible `index.js` files in the same directory as the `package.json` will continue to be resolved instead but that behavior is now deprecated. PR-URL: https://github.com/nodejs/node/pull/26823 Fixes: https://github.com/nodejs/node/issues/26588 Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'doc/api/deprecations.md')
-rw-r--r--doc/api/deprecations.md16
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md
index b23ee43ba5..9820b8039c 100644
--- a/doc/api/deprecations.md
+++ b/doc/api/deprecations.md
@@ -2400,6 +2400,22 @@ Please use the publicly documented [`timeout.refresh()`][] instead.
If unreferencing the timeout is necessary, [`timeout.unref()`][] can be used
with no performance impact since Node.js 10.
+<a id="DEP0128"></a>
+### DEP0128: modules with an invalid `main` entry and an `index.js` file
+<!-- YAML
+changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/26823
+ description: Documentation-only.
+-->
+
+Type: Documentation-only (supports [`--pending-deprecation`][])
+
+Modules that have an invalid `main` entry (e.g., `./does-not-exist.js`) and
+also have an `index.js` file in the top level directory will resolve the
+`index.js` file. That is deprecated and is going to throw an error in future
+Node.js versions.
+
[`--pending-deprecation`]: cli.html#cli_pending_deprecation
[`Buffer.allocUnsafeSlow(size)`]: buffer.html#buffer_class_method_buffer_allocunsafeslow_size
[`Buffer.from(array)`]: buffer.html#buffer_class_method_buffer_from_array