Skip to content

0.1.0 prevent builds from breaking because of React internal access

Latest
Compare
Choose a tag to compare
@phryneas phryneas released this 23 Apr 09:02
1150f7e

What's Changed

  • Add undefined exports for potentially missing React internals. by @phryneas in #10

In the latest React 19 Canary, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED was renamed to __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE and __SERVER_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE.

Since __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED is not present in the exports anymore, some bundlers will error on every reference of that.
Even if it was used in a way that would actually not be breaking, like

if (React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) {
  // more defensive code here
}

your consumer builds might break as a result.

This release exports all three internal objects as undefined (or their real value), which means that such a defensive approach would not be breaking builds.