-
Notifications
You must be signed in to change notification settings - Fork 47k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flight specific entry point for react package (#20304)
This configures the Flight fixture to use the "react-server" environment. This allows the package.json exports field to specify a different resolution in this environment. I use this in the "react" package to resolve to a new bundle that excludes the Hooks that aren't relevant in this environment like useState and useEffect. This allows us to error early if these names are imported. If we actually published ESM, it would we a static error. Now it's a runtime error. You can test this by importing useState in Container.js which is used by the client and server.
- Loading branch information
1 parent
89d4fe1
commit d93b58a
Showing
7 changed files
with
84 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./cjs/react-unstable-index.server.production.min.js'); | ||
} else { | ||
module.exports = require('./cjs/react-unstable-index.server.development.js'); | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
export { | ||
Children, | ||
createRef, | ||
forwardRef, | ||
lazy, | ||
memo, | ||
useCallback, | ||
useContext, | ||
useDebugValue, | ||
useMemo, | ||
useMutableSource as unstable_useMutableSource, | ||
createMutableSource as unstable_createMutableSource, | ||
Fragment, | ||
Profiler, | ||
StrictMode, | ||
Suspense, | ||
createElement, | ||
cloneElement, | ||
isValidElement, | ||
version, | ||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, | ||
// exposeConcurrentModeAPIs | ||
useDeferredValue as unstable_useDeferredValue, | ||
SuspenseList as unstable_SuspenseList, | ||
unstable_useOpaqueIdentifier, | ||
// enableDebugTracing | ||
unstable_DebugTracingMode, | ||
} from './src/React'; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
throw new Error( | ||
'This entry point is not yet supported outside of experimental channels', | ||
); |
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
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