{
  "id": 10688593,
  "title": "In Next.js 16, the return value of require.resolve becomes an integer and the code crashes",
  "url": "https://urgent.news/2026/09/29/in-next-js-16-the-return-value-of-require-resolve-becomes-an-integer",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-29T12:28:47.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/matsumotory/in-nextjs-16-the-return-value-of-requireresolve-becomes-an-integer-and-the-code-crashes-4pbl"
  },
  "original_language": "en",
  "account": "In the production build of Next.js 16, the require.resolve function returns an integer instead of a file location, causing a TypeError. This change does not trigger type checking, unit tests, or direct calls, so they cannot detect the issue. The problem occurs when the base for resolving the package location is set to the process's working directory instead of the package directory. To fix the code, either use the working directory as the base or add a turbopackIgnore annotation. The failure happens right after deployment, and a check starting the same build as production and calling it from outside can help prevent future issues.",
  "summary": "Summary I added one tool, which AI agents call from outside, to a service I develop at my own company. When this tool is called, one page selected from a PDF document stored in the service is converted into a JPEG image and included in the response as an image. Before deploying, the AI in charge of development had passed the type check and every unit test. It had also called the tool's function…",
  "key_points": [
    "Next.js 16 returns integer from require.resolve, causing TypeError",
    "Issue stems from using process working directory as base for resolving",
    "Fix by using working directory as base or adding turbopackIgnore annotation"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}