I’m using Turborepo to manage a monorepo with multiple packages. One of my packages is:
-
@repo/shadcnui (a shared UI library)
- It declares
react@19
as a dependency.
- It declares
I also have an app package in the same repo that lists React as a dependency. When I import components from @repo/shadcnui
into my app and run the build (e.g., with Next.js/Vite/Webpack), will React end up being bundled twice (once for the UI package and once for the app)? Or does Turborepo/your bundler automatically dedupe React into a single copy? How can I ensure React is only included once in my final bundle?