wasp
wasp copied to clipboard
Add `react-dom` and `react-router-dom` deps to the user's `package.json`
Some users when installing deps e.g. react-hot-toast
receive this error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: rrtest@undefined
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"^18.2.0" from the root project
npm ERR! peer react@">=16" from [email protected]
npm ERR! node_modules/react-hot-toast
npm ERR! react-hot-toast@"*" from the root project
npm ERR! 1 more (wasp)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^19.0.0" from [email protected]
npm ERR! node_modules/react-dom
npm ERR! peer react-dom@">=16" from [email protected]
npm ERR! node_modules/react-hot-toast
npm ERR! react-hot-toast@"*" from the root project
Let's take a closer look:
-
peer react@">=16" from [email protected]
- says that
react-hot-toast
will be satisfied with any version of React above and including React 16. - We specified
react@^18.2.0
in the user'spackage.json
- so
npm
goes with that version. - All good ✅
- says that
-
peer react-dom@">=16" from [email protected]
- says that
react-hot-toast
will be satisfied with any version of React DOM above and including React DOM 16. - So,
npm
goes for thelatest
version since we don't specifyreact-dom
in the user'spackage.json
file. - Since React 19 came out, the
latest
means React DOM 19 which then tries to pull React 19. - This conflicts with our React 18 dep 🔴
- says that
A similar thing happened with React Router 7 being released, so we should also put react-router-dom
dep in the user land package.json
.
How to solve this
- I propose we add the
react-dom
andreact-router-dom
in the user'spackage.json
in all the templates.- @vincanger updated Open Saas already
- we need to update the
starters
templates - we need to update the
basic
template (requires new Wasp release)
- Also, let's ping any community template authors to do the same.
- We can add
package.json
validation rules in the next Wasp version to validate if users have these deps in theirpackage.json
for any users. that have an existing project.