From 9fab73c73bab5ed2513a24d81a72a60e629269d4 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Wed, 3 Feb 2021 16:00:01 +0100 Subject: [PATCH] module: runtime deprecate "main" index and extension lookups PR-URL: https://github.com/nodejs/node/pull/37206 Reviewed-By: Guy Bedford Reviewed-By: Benjamin Gruenbaum Reviewed-By: Minwoo Jung Reviewed-By: James M Snell Reviewed-By: Matteo Collina --- doc/api/deprecations.md | 5 ++++- lib/internal/modules/esm/resolve.js | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index fa2f52c8265c2f..860d5aa749f10d 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -2737,13 +2737,16 @@ change the value has been deprecated and will be disabled in the future. ### DEP0151: Main index lookup and extension searching -Type: Documentation-only (supports [`--pending-deprecation`][]) +Type: Runtime Previously, `index.js` and extension searching lookups would apply to `import 'pkg'` main entry point resolution, even when resolving ES modules. diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js index 043e31dc2b66f0..d7e22368f90c8f 100644 --- a/lib/internal/modules/esm/resolve.js +++ b/lib/internal/modules/esm/resolve.js @@ -91,8 +91,6 @@ function emitFolderMapDeprecation(match, pjsonUrl, isExports, base) { } function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) { - if (!pendingDeprecation) - return; const { format } = defaultGetFormat(url); if (format !== 'module') return;