aspect-build / rules_swc

Bazel rules for the swc toolchain https://swc.rs/
https://docs.aspect.build/rules/aspect_rules_swc
Apache License 2.0
41 stars 21 forks source link

chore: update SWC to latest #216

Open alexeagle opened 6 months ago

alexeagle commented 2 months ago

@jbedard I'm taking another pass at getting this working.

I checked my repro that I filed upstream in https://github.com/swc-project/swc/issues/8265 and it's working correctly now: https://github.com/alexeagle/swc_8265_repro/commit/f1b6331f8fee3ad85d418fb1d5a5e20408b7ab3a

however we still get a wrong golden file here when trying to upgrade.

alexeagle commented 2 months ago

@realtimetodie are you still around and interested in this project?

Our guess is that https://github.com/swc-project/swc/commit/7dfdc1221890d373d2e6caf52bc8dee8c20765ca#diff-80747e5885ec3975aab81e2ada0a9d27f3319dc0fb45fa38415e19e9aab629eaR224-R232 is only resolving one hop of the symlink that swc sees for the input file, but there are actually two hops under Bazel. So my original repro wasn't sufficient.

It has been a long time so I doubt we could ask the SWC maintainers to do another round-trip fixing this. I think one of us will have to try ourselves.

@jbedard volunteered today to find some time to make the repro more accurately lay out symlinks the same way Bazel does.

jbedard commented 2 months ago

I've updated the repro to align more with how bazel lays out the bazel-bin + sandbox directories to reproduce the issue: https://github.com/alexeagle/swc_8265_repro/commit/16bfa92286bdafe5dc48ead53c9b4177ce603fbb

alexeagle commented 1 month ago

Yay a fix has landed upstream https://github.com/swc-project/swc/pull/8757

alexeagle commented 1 month ago

ugh @jbedard we are still getting

< const _moduleA = require("../../../../../../.cache/bazel/_bazel_runner/4b45c25630ed5c5c6ea70d3e83a5966d/sandbox/linux-sandbox/42/execroot/aspect_rules_swc/examples/paths/src/modules/moduleA");
INFO: From Testing //examples/paths:test_0_test:
---
> const _moduleA = require("./modules/moduleA/index");
FAIL: files "examples/paths/src/index.js" and "examples/paths/expected.js" differ. 

WHY????