-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Remove re-exports from node
package
#11683
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
Remove re-exports from node
package
#11683
Conversation
|
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/esm/index.mjs", |
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.
Since we're no longer re-exporting the react-router/server
API, consumers now import from both react-router/server
and @react-router/node
in their app. Since react-router/server
ships ESM + CJS while @react-router/node
currently only ships CJS, this introduces a new instance of the dual package hazard since consumers can end up with both ESM and CJS builds in memory. Most of the time this won't cause issues, but it can cause issues with instanceof
checks across this package boundary.
In our case, this issue was caught because we're doing an instanceof MaxPartSizeExceededError
check in integration/error-test.ts
. In our test app, @react-router/node
is using the CJS build of MaxPartSizeExceededError
but then the app code is comparing it to the ESM build of MaxPartSizeExceededError
, resulting in an instanceof
check evaluating to false
. The test failed until this additional ESM version of @react-router/node
was added.
Another alternative would be for us to remove the ESM version of react-router/server
and only use CJS (which @react-router/node
currently does).
// Aliases previously provided by runtime packages | ||
ServerRuntimeMetaArgs as MetaArgs, | ||
ServerRuntimeMetaDescriptor as MetaDescriptor, | ||
ServerRuntimeMetaFunction as MetaFunction, |
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.
☝️ Just calling out that this API is changing since it was being aliased when re-exported from @react-router/node
.
"./install": { | ||
"types": "./dist/install.d.ts", | ||
"default": "./dist/install.js" | ||
}, |
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.
Note, this is replaying a subset of changes from #11675 (along with other related changes in service of this). Now that we have an exports field, this must be included.
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.
Closing for now since this will be revisited on top of #11698.
NOTE: This is a draft PR pointing at #11669.