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

test: paths should resolve without sandbox directories #223

Closed jackvincentnz closed 1 month ago

jackvincentnz commented 4 months ago

Overview

I have been trying to figure out whether this issue is in SWC or rules_swc. For now I am going to leave this here since it is a simple reproduction of the issue I am seeing. For a more in depth reproduction of this working outside Bazel, please see: https://github.com/jackvincentnz/bazel-swc-paths-bug-repo

Motivation

Type of change

Test plan

Summary

Sandbox paths are present in transpiled sources when the module being transformed is nested from the baseUrl configured in .swcrc.

E.g. we expected to see paths resolved to their relative paths:

const _moduleB = require("../moduleB");

But instead we see a sandbox path:

const _moduleB = require("../../../../../../../../../../private/var/tmp/_bazel_jack.vincent/bfa0af320da1536c766f4c861b78e1af/sandbox/darwin-sandbox/6/execroot/aspect_rules_swc/examples/paths/src/modules/moduleB");
jackvincentnz commented 4 months ago

build --modify_execution_info=SWCTranspile=+no-sandbox doesn't seem to make this pass, as mentioned it might in https://github.com/swc-project/swc/issues/4057#issuecomment-1118001633

alexeagle commented 1 month ago

This will be fixed by #216 which was unblocked yesterday thanks to an upstream fix in SWC