deno
b7c367ed - fix(resolver): collapse redundant slashes in file specifiers (#34713)

Commit
54 days ago
fix(resolver): collapse redundant slashes in file specifiers (#34713) A non-normalized relative import such as `import { x } from ".//a.js"` resolves to a file URL with an empty path segment (`file:///dir//a.js`). In a cyclic import graph this empty segment accumulates one more slash on every cycle, so each pass produces a distinct specifier that never dedupes against the already-loaded module. The graph builder keeps recursing until the path exceeds the OS file name length limit and fails with "File name too long". Node resolves the same program without issue. The resolved specifier wasn't being normalized because `deno_path_util::normalize_path` intentionally leaves a lone `//` in place. This collapses redundant path segments in resolved `file:` specifiers via `Path::components()`, so the referrer in the next cycle is already normalized and the import cycle terminates, matching Node. Fixes #23821
Author
Parents
Loading