Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tracking]: unified path normalize behavior #7800

Closed
hardfist opened this issue Sep 4, 2024 · 2 comments
Closed

[Tracking]: unified path normalize behavior #7800

hardfist opened this issue Sep 4, 2024 · 2 comments
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.

Comments

@hardfist
Copy link
Contributor

hardfist commented Sep 4, 2024

Background

let's define two kinds of path first

  • unc path: \\?\C:\foo
  • none unc path(or regular path): C:\foo

currently we have three ways to deal with path normalize, and they're all different

  • std canonicalize: transform all path to unc format
  • dunce::canonicalize dunce::simplified: try best to transform all path to none unc format
  • sugar_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 behavior

mix 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 use sugar_path normalize(which is also fast cause it doesn't touch IO).
we should forbid use std canonicalize in all cases.

@hardfist hardfist added the tracking issue Category: A tracking issue for an RFC or an unstable feature. label Sep 4, 2024
@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Sep 4, 2024
@shulaoda

This comment was marked as off-topic.

@hardfist
Copy link
Contributor Author

can't reproduce the uni bug now, closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

2 participants