wasp-lang / wasp

The fastest way to develop full-stack web apps with React & Node.js.
https://wasp-lang.dev
MIT License
13.53k stars 1.18k forks source link

Solve double installation issue in restructuring #1640

Open sodic opened 8 months ago

sodic commented 8 months ago

[!NOTE] Could be solved by #1838

[no longer up to date] How to reproduce:

  1. Checkout filip-project-install-step
  2. Go to waspc/examples/todo-typescript
  3. Run rm -r .wasp node_modules package-lock.json migrations; cabal run wasp-cli db migrate-dev -- --name init && cabal run wasp-cli start
  4. Open the browser, you should see a white screen and a console full of errors caused by a double react installation

How to fix (temporarily):

Ideas on approaching the issue:

Possible solutions:

infomiho commented 8 months ago

I believe we solved this issues by using the dedupe option in Vite. There were some build issues afterwards, but they seemed unrelated. I'll let @sodic close this when he thinks it's appropriate

sodic commented 8 months ago

I wouldn't close it until we figure out what's causing those build issues. Since they weren't happening unless we do dedupe, they probably are related.

infomiho commented 8 months ago

Some suggestions from the author of the React plugin for Vite that we use: https://github.com/vitejs/vite-plugin-react-swc/issues/184#issuecomment-1899964854

sodic commented 8 months ago

This issue is not react-specific. For example, if one of our inner dependencies (i.e, package.json files inside web-app and server) specifies prisma/client as a dependency, the runtime resolves to the wrong prisma/client installation and breaks.

We've temporarily avoided this problem by moving all the stuff that depends on prisma/client into sdk/package.json.