mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[GH-ISSUE #728] Support file:// URLs from import.meta.resolve() in cacheHandler config path #158
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#158
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @github-actions[bot] on GitHub (Mar 31, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/728
Next.js Change
Commit:
9a0214a1PR: #90370
Next.js now handles
file://URLs in thecacheHandlerconfig path. When"type": "module"is set inpackage.json, users must useimport.meta.resolve()instead ofrequire.resolve()to resolve the cache handler path.import.meta.resolve()returns afile://URL, which previously broke path operations likepath.joinandpath.relative, producing invalid paths andERR_MODULE_NOT_FOUNDerrors.The fix adds a
resolveCacheHandlerPathToFilesystem()helper that convertsfile://URLs to filesystem paths using Node'sfileURLToPath()before any path operations.Relevance to vinext
vinext supports the
cacheHandlerconfig option for pluggable cache backends (ISR cache, KV cache handler for Cloudflare Workers). If vinext resolves or manipulates thecacheHandlerpath fromnext.config.jsusingpath.join,path.relative, or similar path operations, it needs the samefile://URL handling to avoid broken paths in ESM projects.What to implement
cacheHandler(orcacheHandlers) config value, check if the path starts withfile://and convert it to a filesystem path usingnode:url'sfileURLToPath()before any path operations.