-
Notifications
You must be signed in to change notification settings - Fork 79
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
Add explicit exports for node #921
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timostamm
requested changes
Nov 17, 2023
smaye81
commented
Nov 20, 2023
timostamm
approved these changes
Nov 27, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
(Please make sure the PR description is up to date)
This was referenced Nov 29, 2023
Closed
Merged
smaye81
added a commit
to connectrpc/connect-playwright-es
that referenced
this pull request
Dec 5, 2023
This adds explicit exports for node into the package.json for all published packages in Connect-ES. In addition, it modifies the path for the top-level import statement to use ESM instead of the proxy. For additional context, see connectrpc/connect-es#921
smaye81
added a commit
to bufbuild/protobuf-es
that referenced
this pull request
Dec 6, 2023
Fixes #610 This adds explicit exports for node into the package.json for all published packages in Protobuf-ES. In addition, it modifies the path for the top-level import statement to use ESM instead of the proxy. For additional context, see connectrpc/connect-es#921
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to issue #610 experienced in Protobuf-ES. This adds explicit exports for
node
into the package.json for all published packages in Connect-ES. In addition, it modifies the path for the top-levelimport
statement to use ESM instead of the proxy.For more context, check PR #611 in Protobuf-ES as well as the above issue.
Also note that the ideal setting for the
node
imports condition should be something along the lines of:Since any
require
statements for Node should find the top-levelrequire
condition.However, doing so causes the
attw
checks to fail with a Fallback Condition error. So, we have added an additional"require": "./dist/cjs/index.js"
inside thenode
condition to satisfy this check. But, it's unclear whether this is necessary and whether this check is entirely accurate onattw
's part.The claim is that the
require
condition is being resolved due to a TypeScript bug. Theattw
docs state that Node's resolution algorithm "requires that resolution stop once a target filename has been tried, whether or not that file could be found". TypeScript, though, will continue to evaluate conditions if a file cannot be found. Hence, why this check fails -attw
thinks therequire
condition is only being resolved because of a bug in TypeScript.This does not seem to be Node's behavior in practice, though. Node docs clearly state:
In addition, this has been verified with some local checks. So, the tl;dr here is that the
attw
Fallback Condition check seems like it may be incorrect, but needs deeper investigation. In the meantime, we are adding this additionalnode.require
condition to satisfy the check until we can definitively say whether it's needed.