Skip to content

Commit

Permalink
Fix React 18 react-dom/client dynamic import
Browse files Browse the repository at this point in the history
  • Loading branch information
IanVS committed Apr 18, 2022
1 parent 6415d8e commit d19fdec
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app/react/src/client/preview/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ const getReactRoot = async (el: Element): Promise<ReactRoot | null> => {
let root = nodes.get(el);

if (!root) {
// Skipping webpack's static analysis of import paths by defining the path value outside the import statement.
// eslint-disable-next-line import/no-unresolved
const reactDomClient = await import('react-dom/client');
const reactDomClient = (await import('react-dom/client')).default;
root = reactDomClient.createRoot(el);

nodes.set(el, root);
Expand Down

0 comments on commit d19fdec

Please sign in to comment.