Repository: next.js
Issue: [Turbopack] : GraphQL with turbopack
Labels: bug,Turbopack

### Link to the code that reproduces this issue

https://github.com/MersadHabibi/template-fullstack-nextjs-graphql

### To Reproduce

1. run ``` npm run dev ```
2. open ``` /api/graphql ``` route
3. see error

### Current vs. Expected behavior

I was creating a template and ran into trouble with turbopack.

Apollo Studio loads correctly when I don't use turbopack, but when use turbopack i get this error

```
{
  "errors": [
    {
      "message": "module.require is not a function",
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "stacktrace": [
          "TypeError: module.require is not a function",
          "    at createHash (C:\\Users\\kimya\\Desktop\\templates\\test\\.next\\server\\chunks\\node_modules_9a9996._.js:4182:23)",
          "    at Object.html (C:\\Users\\kimya\\Desktop\\templates\\test\\.next\\server\\chunks\\node_modules_@apollo_server_dist_4d2543._.js:2381:247)",
          "    at ApolloServer.executeHTTPGraphQLRequest (C:\\Users\\kimya\\Desktop\\templates\\test\\.next\\server\\chunks\\node_modules_@apollo_server_dist_4d2543._.js:1948:77)"
        ]
      }
    }
  ]
}
```
![Screenshot 2024-11-11 122731](https://github.com/user-attachments/assets/6e0f6dc7-b77d-46f6-90e7-8d7d80a10ec9)

```
Landing page `html` function threw: TypeError: module.require is not a function
```
![Screenshot 2024-11-11 122810](https://github.com/user-attachments/assets/7bac9d42-288a-4ec9-b4e2-a1e940f0343e)

this is my repo link
[link](https://github.com/MersadHabibi/template-fullstack-nextjs-graphql)


### Provide environment information

```bash
Node.js v20.15.0

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Pro
  Available memory (MB): 12072
  Available CPU cores: 8
Binaries:
  Node: 20.15.0
  npm: 10.7.0
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.0.3 // Latest available version is detected (15.0.3).
  eslint-config-next: 15.0.3
  react: 19.0.0-rc-66855b96-20241106
  react-dom: 19.0.0-rc-66855b96-20241106
  typescript: 5.6.3
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

its only happen on development mode with turbopack

route.ts
```typescript
import { ApolloServer } from "@apollo/server";
import {
  ApolloServerPluginLandingPageLocalDefault,
  ApolloServerPluginLandingPageProductionDefault,
} from "@apollo/server/plugin/landingPage/default";
import { startServerAndCreateNextHandler } from "@as-integrations/next";
import { PrismaClient } from "@prisma/client";
import fs from "fs";
import {
  DateTimeTypeDefinition,
  PositiveFloatTypeDefinition,
  PositiveIntTypeDefinition,
  URLTypeDefinition,
} from "graphql-scalars";
import { NextRequest } from "next/server";
import path from "path";
import resolvers from "./resolvers";

let typeDefs = "";

let plugins = [];
if (process.env.NODE_ENV === "production") {
  typeDefs = fs.readFileSync(
    path.join(path.resolve(), "./src/app/api/graphql/schema.graphql"),
    "utf-8",
  );

  plugins = [
    ApolloServerPluginLandingPageProductionDefault({
      embed: true,
      graphRef: "mersad.up@gmail.com",
    }),
  ];
} else {
  typeDefs = fs.readFileSync("./src/app/api/graphql/schema.graphql", "utf8");

  plugins = [ApolloServerPluginLandingPageLocalDefault({ embed: true })];
}

const server = new ApolloServer({
  typeDefs: [
    typeDefs,
    DateTimeTypeDefinition,
    PositiveIntTypeDefinition,
    PositiveFloatTypeDefinition,
    URLTypeDefinition,
  ],
  resolvers: {
    ...resolvers,
    // DateTimeResolver,
    // PositiveFloatResolver,
    // PositiveIntResolver,
    // URLResolver,
  },
  plugins,
});

const handler = startServerAndCreateNextHandler<NextRequest>(server, {
  context: async (req) => {
    const prisma = new PrismaClient();

    prisma.$connect();

    return {
      req,
      prisma,
    };
  },
});

export async function GET(request: NextRequest) {
  return handler(request);
}

export async function POST(request: NextRequest) {
  return handler(request);
}

```