Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module: runtime deprecate invalid package.json main entries #37204

Merged
merged 2 commits into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2347,12 +2347,15 @@ with no performance impact since Node.js 10.
### DEP0128: modules with an invalid `main` entry and an `index.js` file
<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/
aduh95 marked this conversation as resolved.
Show resolved Hide resolved
description: Runtime deprecation.
- version: v12.0.0
pr-url: https://github.com/nodejs/node/pull/26823
description: Documentation-only.
-->

Type: Documentation-only (supports [`--pending-deprecation`][])
Type: Runtime

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
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ function tryPackage(requestPath, exts, isMain, originalPath) {
err.requestPath = originalPath;
// TODO(BridgeAR): Add the requireStack as well.
throw err;
} else if (pendingDeprecation) {
} else {
const jsonPath = path.resolve(requestPath, 'package.json');
process.emitWarning(
`Invalid 'main' field in '${jsonPath}' of '${pkg}'. ` +
Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-module-loading-deprecated.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Flags: --pending-deprecation

'use strict';

const common = require('../common');
Expand Down