I have a Next.js page where I am fetching data from a database using prisma as the ORM within the getServerSideProps()
function.
I'm following an example provided in this official Prisma github repository. Here's a simplified version of how my page is set up:
import prisma from 'prisma';
export const getServerSideProps = async ({ req, res }) => {
const drafts = await prisma.post.findMany(...);
};
const MyPage = () => {return <div>Hello</div>};
export default MyPage;
In this setup, Prisma is imported into the page file and utilized in getServerSideProps()
, but it is not directly used in the exported page component itself. Now, my inquiry is whether Prisma will be included in the bundle that is sent to the browser along with this page. Or does Next.js automatically exclude packages that are only referenced in server-side functions?