Skip to content

Custom cache handler cannot be defined since v15.5.1-canary.33 #83573

@cornedor

Description

@cornedor

Link to the code that reproduces this issue

https://github.com/cornedor/next-node-ts

To Reproduce

  1. Clone the repo and install deps using npm install
  2. Run npm run build to build the app
  3. Run npm run start to start the app
  4. Open http://localhost:3000, an error will be thrown

Current vs. Expected behavior

next-node-ts on  main [!?] via  v22.18.0 via 󰜈 19.1.0
❯ npm run build

[email protected] build
next build --turbopack

(node:87262) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///Users/corne/Development/next-node-ts/next.config.ts is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to /Users/corne/Development/next-node-ts/package.json.
(Use node --trace-warnings ... to show where the warning was created)
▲ Next.js 15.5.1-canary.33 (Turbopack)

Creating an optimized production build ...
(node:87264) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///Users/corne/Development/next-node-ts/next.config.ts is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to /Users/corne/Development/next-node-ts/package.json.
(Use node --trace-warnings ... to show where the warning was created)
✓ Finished writing to disk in 52ms
✓ Compiled successfully in 2.6s
✓ Linting and checking validity of types
✓ Collecting page data
✓ Generating static pages (4/4)
✓ Finalizing page optimization

Route (app) Size First Load JS
┌ ○ / 5.44 kB 119 kB
└ ○ /_not-found 0 B 114 kB

  • First Load JS shared by all 114 kB
    ├ chunks/00327e39604288fd.js 20.6 kB
    ├ chunks/643e8832df2a34e0.js 75.7 kB
    └ other shared chunks (total) 17.5 kB

○ (Static) prerendered as static content

next-node-ts on  main [!?] via  v22.18.0 via 󰜈 19.1.0 took 4s
❯ npm run start

[email protected] start
next start

▲ Next.js 15.5.1-canary.33

✓ Starting...
(node:87537) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///Users/corne/Development/next-node-ts/next.config.ts is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to /Users/corne/Development/next-node-ts/package.json.
(Use node --trace-warnings ... to show where the warning was created)
✓ Ready in 204ms
⨯ Error: Cannot find module '/Users/corne/Development/next-node-ts/.next/cache-handler.mjs' imported from /Users/corne/Development/next-node-ts/node_modules/next/dist/server/next-server.js
at ignore-listed frames {
code: 'ERR_MODULE_NOT_FOUND',
url: 'file:///Users/corne/Development/next-node-ts/.next/cache-handler.mjs'
}

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:30 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6020
  Available memory (MB): 65536
  Available CPU cores: 12
Binaries:
  Node: 22.18.0
  npm: 10.9.3
  Yarn: 1.22.22
  pnpm: 10.15.1
Relevant Packages:
  next: 15.5.1-canary.33 // Latest available version is detected (15.5.1-canary.33).
  eslint-config-next: 15.5.1-canary.33
  react: 19.1.0
  react-dom: 19.1.0
  typescript: 5.9.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Module Resolution, Output, Runtime

Which stage(s) are affected? (Select all that apply)

next start (local), Other (Deployed), Vercel (Deployed)

Additional context

I've tried using:

  1. require.resolve, which is no longer available
  2. import.meta.resolve, includes file: and causes another error, when stripped it still breaks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Module ResolutionModule resolution (CJS / ESM, module resolving).OutputRelated to the the output configuration option.RuntimeRelated to Node.js or Edge Runtime with Next.js.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions