Repository navigation
Element: Make the package importable in React 19 #80053
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,19 @@ | ||
| /** | ||
| * External dependencies | ||
| */ | ||
| import { | ||
| import * as ReactDOM from 'react-dom'; | ||
| import { createRoot, hydrateRoot } from 'react-dom/client'; | ||
|
|
||
| const { | ||
| createPortal, | ||
| findDOMNode, | ||
| flushSync, | ||
| /* eslint-disable react/no-deprecated */ | ||
| findDOMNode, | ||
| render, | ||
| hydrate, | ||
| unmountComponentAtNode, | ||
| /* eslint-enable react/no-deprecated */ | ||
| } from 'react-dom'; | ||
| import { createRoot, hydrateRoot } from 'react-dom/client'; | ||
| } = ReactDOM; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to reorganize this import?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not a cosmetic reorganization. React 19 removed With static named imports, those bindings must be resolvable at module link time. When a consumer loads Solution: A namespace import like this.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, that makes sense. Which ESM runtime does throw exactly this error? The native ESM resolver in Node, or in browsers? Or a bundler (esbuild or webpack) runtime? |
||
|
|
||
| /** | ||
| * Creates a portal into which a component can be rendered. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.