mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
## Summary Fixes #73796 ### The Bug When "type": "module" is in package.json, users cannot use require.resolve() for the cache handler path. They must use import.meta.resolve() instead, which returns a file:// URL. Next.js was concatenating this URL with .next/ producing invalid paths and ERR_MODULE_NOT_FOUND errors. ### The Fix 1. resolveCacheHandlerPathToFilesystem() - New helper that converts file:// URLs to proper filesystem paths using Node's fileURLToPath() 2. formatDynamicImportPath() - Now calls resolveCacheHandlerPathToFilesystem() before any path operations 3. Applied in collect-build-traces.ts, build/index.ts, and build/swc/index.ts This ensures ESM import.meta.resolve() cache handler paths work correctly in all code paths. --------- Co-authored-by: JJ Kasper <[email protected]>