Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Project fails to build with nuxt-prisma #4

Closed
ohmree opened this issue Dec 14, 2022 · 6 comments
Closed

Project fails to build with nuxt-prisma #4

ohmree opened this issue Dec 14, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@ohmree
Copy link

ohmree commented Dec 14, 2022

Environment

Nuxi 3.0.0

RootDir: /tmp/test
Nuxt project info:


  • Operating System: Linux
  • Node Version: v19.2.0
  • Nuxt Version: 3.0.0
  • Nitro Version: 1.0.0
  • Package Manager: pnpm@7.18.2
  • Builder: vite
  • User Config: extends
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://github.com/ohmree/nuxt-prisma-repro

Describe the bug

When building a nuxt app created with pnpm dlx nuxi init <name> and with the simplest @sidebase/nuxt-prisma config, it chokes on some of the nuxt-prisma code - seems like some rollup plugin tries to parse typescript as javascript.

Additional context

No response

Logs

$ pnpm build # this is run in the context of the linked reproduction repo

> @ build /tmp/test
> nuxt build

Nuxi 3.0.0
Nuxt 3.0.0 with Nitro 1.0.0
ℹ Client built in 997ms
ℹ Building server...
✔ Server built in 551ms
✔ Generated public .output/public
ℹ Building Nitro Server (preset: node-server)

 WARN  rollup-plugin-inject: failed to parse /tmp/test/node_modules/.pnpm/@sidebase+nuxt-prisma@0.1.0/node_modules/@sidebase/nuxt-prisma/nuxt-prisma/server/middleware/0.prisma.ts. Consider restricting the plugin to particular files via options.include


 ERROR 

2: import { eventHandler } from 'h3'
3: 
4: let prisma: PrismaClient
             ^
5: declare module 'h3' {
6:   interface H3EventContext {


 ERROR  Unexpected token (Note that you need plugins to import files that are not JavaScript)

  at error (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:1858:30)
  at Module.error (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:12429:16)
  at Module.tryParse (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:12806:25)
  at Module.setSource (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:12711:24)
  at ModuleLoader.addModuleSource (node_modules/.pnpm/rollup@2.79.1/node_modules/rollup/dist/es/shared/rollup.js:21959:20)

 ELIFECYCLE  Command failed with exit code 1.
@ohmree ohmree added the bug Something isn't working label Dec 14, 2022
@BracketJohn
Copy link
Contributor

Hey @ohmree 👋

Thanks for reporting this - we'll look into it ASAP!

@BracketJohn
Copy link
Contributor

Oh, and btw: Thank you so much for providing a repro, verryyy helpful! 💯 ❤️

@BracketJohn
Copy link
Contributor

So, I tried to reproduce it by doing the following:

git clone https://github.com/ohmree/nuxt-prisma-repro
cd nuxt-prisma-repro

pnpm i
pnpm run build

and the error appeared.

The interesting part is: When I do it with npm the problem does not appear:

git clone https://github.com/ohmree/nuxt-prisma-repro
cd nuxt-prisma-repro

npm i
npm run build

Will further look into it, at the moment this problem seems to be pnpm specific.

@BracketJohn
Copy link
Contributor

Sorry, didn't mean to automatically close this issue via my commit -> reopening it while I'm testing whether the fix worked (:

@BracketJohn
Copy link
Contributor

BracketJohn commented Jan 5, 2023

Heya!

We're actively persuing this:

I think if nuxt/nuxt#12394 is merged this will be fixed with the release of Nuxt 3.1.0 which was due end of December, so is likely going to happen soon: nuxt/framework#9741

Thanks @manniL for following through with this in our Discord convo -> amazing ❤️

@BracketJohn
Copy link
Contributor

Hey 🧇

It turns out that sadly this is too much overhead to resolve - see #6 for problems that layers currently have. As this is a lyaer with just two files, we decided to instead directly integrate it into create-sidebase which resolves all of these problems and uses vanilla Nuxt, so if any of the problems occur we can be sure that they come from upstream.

Sorry for the bad news. We have a terminated, planned transition - read #6 for more. Let me know here if you need any specific help, I'd be happy to hop on a call to resolve your inidividual problem so that you still ahve a good experience with Nuxt + Prisma.

If you start a new project, I recommend that you use the cli like so:

# also works with yarn, pnpm
npm create sidebase@latest

to get prisma for free.

closing this, please add a new comment or ask something in #6 if it is related to the deprecation. Thanks ❤️

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants