Skip to content

Commit

Permalink
lib: add hot path for noDeprecation for esm
Browse files Browse the repository at this point in the history
  • Loading branch information
H4ad committed Jun 1, 2023
1 parent 85ac915 commit c3a6af2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion benchmark/esm/esm-loader-defaultResolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const configs = {
};

const options = {
flags: ['--expose-internals'],
flags: ['--expose-internals', '--no-deprecation'],
};

const bench = common.createBenchmark(main, configs, options);
Expand Down
4 changes: 4 additions & 0 deletions lib/internal/modules/esm/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ function emitInvalidSegmentDeprecation(target, request, match, pjsonUrl, interna
* @returns {void}
*/
function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) {
if (process.noDeprecation) {
return;
}

const format = defaultGetFormatWithoutErrors(url);
if (format !== 'module')
return;
Expand Down

0 comments on commit c3a6af2

Please sign in to comment.