If I understand this correctly, react-abode-npm is used during runtime (at least the underlying react part) - while bud is used during build-time, so their react dependency versions shouldnβt conflict?
The problem seems to be that react, react-dom and react-abode ship in version 18.2.0, but bud uses React in version 17. (Found out by using npm explain react-dom) When I run yarn build or yarn dev the compile works fine - but I get the following runtime error:
client.js:12 Uncaught (in promise) TypeError: m.createRoot is not a function
at exports.createRoot (client.js:12:1)
at react-abode.esm.js:635:1
When I use the debugger I also can see that it loads react-dom in version 17.0.2. Do you have any idea?
Indeed, bud-reacthas react@17 as dependency.
However, npm should install a different react package version and require/import should also resolve to it.
Thanks for your answer and your help. Sadly it doesnβt work for me, because Iβm not adding the old react-dom version (17.0.2) directly over my package.json, Iβm only loading the new version.
npm explain react-dom gives me the following output:
react-dom@18.2.0
node_modules/react-dom
react-dom@"^18.2.0" from the root project
peer react-dom@">=18" from react-abode@2.0.0
node_modules/react-abode
react-abode@"^2.0.0" from the root project
peer react-dom@">=16.8.0" from react-animate-height@3.1.0
node_modules/react-animate-height
react-animate-height@"^3.1.0" from the root project
react-dom@17.0.2 dev
node_modules/@roots/bud-react/node_modules/react-dom
react-dom@"17.0.2" from @roots/bud-react@6.6.6
node_modules/@roots/bud-react
@roots/bud-react@"6.6.6" from @roots/bud-preset-wordpress@6.6.6
node_modules/@roots/bud-preset-wordpress
@roots/bud-preset-wordpress@"6.6.6" from @roots/sage@6.6.6
node_modules/@roots/sage
dev @roots/sage@"6.6.6" from the root project
peerOptional @roots/bud-react@"*" from @roots/sage@6.6.6
node_modules/@roots/sage
dev @roots/sage@"6.6.6" from the root project
peer react-dom@"^15.0.0 || ^16.0.0 || ^17.0.0" from react-hot-loader@4.13.1
node_modules/@roots/bud-react/node_modules/react-hot-loader
react-hot-loader@"^4.13.1" from @roots/bud-react@6.6.6
node_modules/@roots/bud-react
@roots/bud-react@"6.6.6" from @roots/bud-preset-wordpress@6.6.6
node_modules/@roots/bud-preset-wordpress
@roots/bud-preset-wordpress@"6.6.6" from @roots/sage@6.6.6
node_modules/@roots/sage
dev @roots/sage@"6.6.6" from the root project
peerOptional @roots/bud-react@"*" from @roots/sage@6.6.6
node_modules/@roots/sage
dev @roots/sage@"6.6.6" from the root project
I cannot change the react-dom@17.0.2 reference because it is implicitly loaded from another package. (bud-react) Do you have any other idea?
β― yarn why react
[1/4] π€ Why do we have the module "react"...?
[2/4] π Initialising dependency graph...
[3/4] π Finding dependency...
[4/4] π‘ Calculating file sizes...
=> Found "react@18.2.0"
info Has been hoisted to "react"
info Reasons this module exists
- Specified in "dependencies"
- Hoisted from "@roots#sage#@roots#bud-preset-wordpress#@roots#bud-react#react"
=> Found "@roots/bud-support#react@17.0.2"
info This module exists because "@roots#bud#@roots#bud-support" depends on it.