[Tracking]: unified path normalize behavior #7800
Labels
team
The issue/pr is created by the member of Rspack.
tracking issue
Category: A tracking issue for an RFC or an unstable feature.
Background
let's define two kinds of path first
\\?\C:\foo
C:\foo
currently we have three ways to deal with path normalize, and they're all different
std canonicalize
: transform all path to unc formatdunce::canonicalize dunce::simplified
: try best to transform all path to none unc formatsugar_path normalize
: if input is unc then output is unc, if input is none unc then output is none unc, which is nearly the same as nodejs normalize behaviormix usage of unc path and regular will cause hard to debug bugs, so it would be better to unified path format in rspack
Suggestions
all the input path(means all the path not generated from other normalize behavior) should be normalized with
dunce::simplified
(which is performance friendly since it doesn't touch IO, credits to @hyf0 suggestion), and all the following normalized path derived from input path should usesugar_path normalize
(which is also fast cause it doesn't touch IO).we should forbid use
std canonicalize
in all cases.The text was updated successfully, but these errors were encountered: