Skip to content

Frontend doesn't render when there's an empty Prisma schema #2798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cprecioso opened this issue May 27, 2025 · 2 comments
Open

Frontend doesn't render when there's an empty Prisma schema #2798

cprecioso opened this issue May 27, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@cprecioso
Copy link
Member

cprecioso commented May 27, 2025

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:

alias: [
{
// Vite doesn't look for `.prisma/client` imports in the `node_modules`
// folder. We point it to the correct place here.
find: /^\.prisma\/(.+)$/,
replacement: path.join(
"{= projectDir =}",
"node_modules/.prisma/$1"
),
},
],

To Reproduce

  1. wasp new
  2. wasp start
  3. Browser is blank

Expected behavior

The template page shows up

Screenshots

Image

Possible solutions

  • Do not import @prisma/client from wasp/core/serialization if 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 (?)
@cprecioso cprecioso added the bug Something isn't working label May 27, 2025
@cprecioso cprecioso changed the title Page doesn't render on empty Prisma client Frontend doesn't render when there's an empty Prisma schema May 27, 2025
@jmeena660
Copy link

jmeena660 commented May 27, 2025

Please provide access to the Notion doc. In my case, it’s working fine. If you are using WSL to run the app and trying to render it on Windows, it might not work. You have to run Firefox installed in your WSL and open localhost:xxxx there. You can start it on firefox using -> firefox localhost:xxxx (command in wsl)

Image

Image

@cprecioso
Copy link
Member Author

Hi, this is an error only present in the development version of Wasp. Release versions are not affected. You're good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants