Replies: 1 comment
-
|
Thank you for this mention. I've made an issue out of this to get this taken care of: #6513 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
To provide context, I was transitioning from a single Next.js project to a monorepo. As part of this transition, I created an internal package for my Prisma database and updated the imports from
"../lib/prisma"to"@acme/prisma". However, this change resulted in a new error that started appearing on some Next.js pages:This was unexpected because I hadn't made any other changes. Upon investigation, I realized that the error was caused by importing types into client components and the Prisma client being bundled in the client code:
For the record, I should probably import the above using
import type, but that's beyond the point. Additionally, I needed to import some enum values as values, not types.I recalled that for tree-shaking to work, the package should be side-effect free. By adding
"sideEffects": falseto the internal package's package.jsonNext.js was able to successfully tree-shake the package.I'm starting this discussion because I'm not an expert on library bundling, and I'm unsure if what I'm doing is incorrect in any way. However, I thought it would be a valuable addition to the internal package's documentation if it is indeed important.
Beta Was this translation helpful? Give feedback.
All reactions