-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
fix(swc): Remove import statement canonicalization #6716
Conversation
The tests are failing with the same error message. I am not sure how to handle this.
|
I'll fix CI with another PR |
7a6ceb9
to
071d391
Compare
Rebased with main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
swc-bump:
- swc
I'm considering reverting this because of #6782. |
I added reverting commit to #6930 |
Why was this reverted? @kdy1 This breaks rules_swc @alexeagle |
Because this PR is breaking a valid app and there's no test case in this PR |
Fixes an issue where import statements to symbolic links (symlinks) are canonicalized in generated code and use the absolute form of the path with all intermediate components normalized and symbolic links resolved.
Import resolution was introduced in #1834.
However, resolving symbolic links in generated code is unnecessary. A JavaScript runtime (Node.js, Deno) will resolve import statements to symbolic links at runtime.
The suggested solution introduces a new
match
guard to determine whether the path is relative and uses the current working directory as a base path. For example, the current working directory is already used as a base path for module resolutionswc/crates/swc_ecma_transforms_module/src/path.rs
Line 276 in 072bd13
Actual behavior (generated code, canonicalized import statement from a symbolic link)
Expected behavior
Related