-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
jsc.paths regression in 1.3.79 #8265
Comments
I don't think it's culprit 🤣 |
Note that I'll investigate, but if fixing this issue results in something which does not match |
Did you try some newer versions? I think it will error with a more useful error complaining about |
Yes, this is a regression. The tsc compiler does not re-write import/require statements to symbolic links. Actually, if you look into the source code of the tsc compiler and how symbolic links are handled, you won't find anything special, because tsc simply relies on the Node.js runtime's path module. |
Yeah actually the |
@kdy1 I can build a repro without Bazel, the difference is that the input files are staged as symlinks. |
Ah, it would be nice. I need to create a test case without using Bazel |
Repro:
Running the script gives this output:
Here's a GH repo with the files: https://github.com/alexeagle/swc_8265_repro/ I confirmed that downloading from https://github.com/swc-project/swc/releases/tag/v1.3.78 instead gives the expected |
I managed to write a test which actually create symlink, and invoke Rust CLI to prevent regression perfectly. |
Feel free to contribute test case to the file. |
Amazing thank you @kdy1 ! I've never written Rust so I don't think you'd want my contribution to that test case. It looks sufficient already though. Does it need more changes before landing? |
It just needs an approval 😄 |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Describe the bug
swc re-writes import paths by following symlinks, it seems. I believe this is a regression from one of the changes @realtimetodie made when we originally got SWC working under Bazel.
It now looks like:
Minimal repro:
npx @bazel/bazelisk build --subcommands examples/paths:compile
bazel-bin/examples/paths/src/index.js
and you'll see therequire
path is relativeLATEST_SWC_VERSION = "v1.3.78"
to v1.3.79 inswc/repositories.bzl
If you need the minimal repro to not involve Bazel, we can engineer one that creates a similar symlink tree to reproduce the problem without it.
Input code
Config
Playground link (or link to the minimal reproduction)
https://github.com/aspect-build/rules_swc/pull/216/files
SWC Info output
swc-darwin-arm64 --version
SWC 0.91.64
Expected behavior
SWC 1.3.78 produces
In #8258 you suggested that we compare with what tsc produces. As I understand it, typescript never attempts to re-write import/require statements. So the result is here
https://github.com/aspect-build/rules_swc/pull/216/files#diff-e3a9eafb3b943b9863d6cea0b348d4ef40bc1b7bb5867a38ac889fcacea0cbf4R3
Actual behavior
SWC 1.3.79 produces
Version
1.3.79
Additional context
In 1.3.78 this worked, so #7852 is the likely culprit, as @kdy1 agrees #8258 (comment)
The text was updated successfully, but these errors were encountered: