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

Paths cannot be normalized or are normalized incorrectly #11

Open
Chriscbr opened this issue Feb 8, 2023 · 0 comments
Open

Paths cannot be normalized or are normalized incorrectly #11

Chriscbr opened this issue Feb 8, 2023 · 0 comments

Comments

@Chriscbr
Copy link

Chriscbr commented Feb 8, 2023

Thanks for creating this library. The source code is well written and easy to understand.

I encountered an issue was that node resolution didn't work when the library is compiled to WASM since "path.canonicalize" is not available on that platform (see WebAssembly/wasi-filesystem#27).

To mitigate that I tried using the preserve_symlinks option to switch to the library's internal normalize_path function, but this option also didn't work for us because some paths are transformed incorrectly. For example, in node, path.normalize("../foo/bar/../baz") returns ../foo/baz -- but the internal normalize_path function in this library converts the same path into /foo/baz.

For the second issue, it could be possible to fix the function directly, but to resolve the first issue, I wonder if it would make sense to use a library like https://crates.io/crates/normpath instead of fs::canonicalize.

Is it possible to implement node module resolution without performing any path normalization / provide that as an option?

I'd be happy to try making a pull request if that was helpful. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant