wasp
wasp copied to clipboard
Frontend doesn't render when there's an empty Prisma schema
Describe the bug
Write-up: https://www.notion.so/wasp-lang/Error-writeup-Browser-error-on-blank-project-20018a74854c80249e83ec893c7d6d91?pvs=4
wasp/core/serialization is calling @prisma/client as part of its logic. When the Prisma schema doesn't have any models, @prisma/client is an empty placeholder in the CJS format instead of ESM, which trips up Vite.
OTOH, it seems like this workaround is not needed anymore: https://github.com/wasp-lang/wasp/blob/014f661a27f829bddf2290f7cdf1cd7c38f3387c/waspc/data/Generator/templates/react-app/vite.config.ts#L44-L54
To Reproduce
wasp newwasp start- Browser is blank
Expected behavior
The template page shows up
Screenshots
Possible solutions
- Do not import
@prisma/clientfromwasp/core/serializationif there aren't any Prisma models - Wrap that import in a
try..catch - Create a Vite plugin that correctly resolves whether Prisma is being a CJS or ESM file
- Update Prisma
- Something else (?)