Skip to content

Commit ee8b050

Browse files
narwoldJudahmeek
authored andcommitted
Switch ReactDOM to ESM import to match ESM exports
We are experiencing a breaking change when using react_ujs@2.6.2 (2.6.1 worked fine) when built into a Vite project. ReactDOM is not defined when attempting to import it in `renderHelpers.js`. Through changing the code in node_modules for react_ujs, we have found that changing ReactDOM to an ESM import resolves the issue. This is because build tools often (I recall having this issue in the past with Webpack) have trouble mixing requires (non-ESM) with ESM exports. This PR resolves this issue by changing to an import.
1 parent ca2c2af commit ee8b050

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

react_ujs/src/renderHelpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const ReactDOM = require("react-dom")
1+
import ReactDOM from "react-dom"
22

33
export function supportsHydration() {
44
return typeof ReactDOM.hydrate === "function" || typeof ReactDOM.hydrateRoot === "function"

0 commit comments

Comments
 (0)