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

package self-reference works without a flag in node v12.16 #31754

Closed
ljharb opened this issue Feb 12, 2020 · 3 comments
Closed

package self-reference works without a flag in node v12.16 #31754

ljharb opened this issue Feb 12, 2020 · 3 comments
Labels
confirmed-bug Issues with confirmed bugs. esm Issues and PRs related to the ECMAScript Modules implementation. module Issues and PRs related to the module subsystem.

Comments

@ljharb
Copy link
Member

ljharb commented Feb 12, 2020

Repro: clone https://github.com/ljharb/has-package-exports

It has a dev dep of "has-package-exports": "file:.", so that in every node version, i can require('has-package-exports') from within the package, and it works.

In node v13.6 and v12.15, node test passes without issuing (node:96292) ExperimentalWarning: Package name self resolution is an experimental feature. This feature could change at any time as a warning.

In node v13.7, the warning is correctly issued, and the local dev dep is byassed.

However, in node v12.16, without passing any flags, the warning is issued and the local dev dep is bypassed. v12.16 and v12.15 should behave identically with respect to this feature, regardless of the presence of "exports" in package.json.

cc @nodejs/modules-active-members

@ljharb ljharb added module Issues and PRs related to the module subsystem. esm Issues and PRs related to the ECMAScript Modules implementation. labels Feb 12, 2020
@guybedford
Copy link
Contributor

This is definitely a bug, unfortunately due to the nature of the backporting process between the flagged and unflagged implementations. The fix would be to include an explicit if (!experimentalModules) return in the first line of the trySelf function in lib/internal/modules/cjs/loader.js for the 12.x branch.

@guybedford guybedford added confirmed-bug Issues with confirmed bugs. v12.x labels Feb 12, 2020
@MylesBorins
Copy link
Member

we can get out an emergency release to fix this

@ljharb
Copy link
Member Author

ljharb commented Feb 14, 2020

Looks like this was resolved in f0b2d87, and may be released in #31781

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. esm Issues and PRs related to the ECMAScript Modules implementation. module Issues and PRs related to the module subsystem.
Projects
None yet
Development

No branches or pull requests

3 participants