vercel / next.js

The React Framework
https://nextjs.org
MIT License
122.59k stars 26.23k forks source link

With turbopack, re-exports such as "export * from '@prisma/client' are not processed correctly (monorepo) #67195

Open tomitrescak opened 3 days ago

tomitrescak commented 3 days ago

Link to the code that reproduces this issue

https://github.com/vercel/turbo/tree/main/examples/with-prisma

To Reproduce

I am suing standard starter for turbobuild with prisma

  1. Add the following code to "app/page.tsx"
import * as Prisma from "@repo/database";
console.log(Prisma);
  1. Run "pnpm generate" to generate your DB (change to sqlite if you need)
  2. Run "pnpm dev --turbo"
  3. Observer that none of the "re-exports" from the database are available (only "prisma", which is re-exported specifically)
  4. Run "pnpm dev"
  5. See that all exports are now available

Current vs. Expected behavior

Currently, when re-exporting from prisma/client in a turborepo the exports are NOT included.

I want to be able to re-export from package in turborepo with "export * from '@prisma/client'

I have enums and other structures that I need to be exported.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 10
Binaries:
  Node: 21.7.2
  npm: 10.5.2
  Yarn: 1.22.19
  pnpm: 9.4.0
Relevant Packages:
  next: 15.0.0-rc.0 // Latest available version is detected (15.0.0-rc.0).
  eslint-config-next: 14.2.4
  react: 19.0.0-rc-107a2f8c3e-20240617
  react-dom: 19.0.0-rc-107a2f8c3e-20240617
  typescript: 5.5.1-rc
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

No response

tomitrescak commented 3 days ago

FYI, the following does not work with turbopack, only with webpack:

export * from "@prisma/client";

This does work with turbopack

export { AchievementType, PrismaClient } from "@prisma/client";

Not optimal.