-
-
Notifications
You must be signed in to change notification settings - Fork 21
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 package-relative paths for external sources #128
Conversation
b55b2c8
to
6346fdf
Compare
Thanks! Also note that next week we'll land #57 and will stop using short_path because we won't run swc under the nodejs binding anymore, and can follow "normal" bazel pathing idioms. |
Release v0.21.0 is published, I think that should solve this issue by removing the short_path logic altogether. |
Nice! I tested with v0.21.0, and it looks like we still need the fix for Side note, v0.21.0 is blazing fast 🔥 I can't even see the SWC compile actions in the progress output after a clean build. |
Context: this unblocks migration of BuildBuddy to
rules_js
. We build our app externally likebazel build @com_github_buildbuddy_io_buildbuddy//enterprise/app:app_bundle
when deploying via our internal repo, and this is broken because the current logic in rules_swc results in files being written to the wrong path.Before, we'd get an error from esbuild like
app.tsx: ERROR: Could not resolve "./root/root"
, and inspecting the sandbox dir after building with--sandbox_debug
, the tree would look like this (filtering just toapp.tsx
androot.js
here which are the main relevant files):The problem is that
esbuild
can't locate./root/root.js
because it's nested under./external/com_github_buildbuddy_io_buildbuddy/enterprise/app/root/
relative toapp.tsx
, when it should just be under./root/root
.This PR fixes that issue. After the fix, the directory structure looks like this: