I migrated from cra to vite and now have the this problem:
When hmr is triggered, or when I visit another page (sometimes), the page goes blank and I get many errors:
Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
The above error occurred in the <Fragment> component:
The above error occurred in the <StrictMode> component:
Also:
Warning: You are calling ReactDOMClient.createRoot() on a container that has already been passed to createRoot() before. Instead, call root.render() on the existing root instead if you want to update it.
However, I call createRoot only once in main.tsx file.
I use react-router-dom: version "^6.4.2".
I see the removeChild error after build too, unfortunately.
What did I wrong during the migration process?