-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
[Bug]: sourcemap paths are not relative #166
Comments
Note, this is pretty typical under Bazel since tools are run in a working directory at the repository root. Options:
|
@realtimetodie any ideas on whether option 1 is feasible? |
Maybe it's just that we need |
Yes, the source_root option is not implemented in the Rust-based SWC cli. In the Node.js @swc/cli the entire source map is reparsed as JSON again, see swc-project/swc#1388. I mentioned this bug in #154 (comment). I will look into it this weekend |
Ping @realtimetodie have any time to look? If not maybe @titanous who contributed another swc fix? |
Yes, I'm about to complete it. I have some more time tomorrow. |
The changes were merged upstream. Here is an example https://github.com/realtimetodie/rules_swc/tree/bug-166 |
Cool, I guess we're waiting on an swc release before we can upgrade here to land the fix. |
@realtimetodie user question on this that I'm not sure how to answer: https://bazelbuild.slack.com/archives/CEZUUKQ6P/p1677624490464619?thread_ts=1675968328.558779&cid=CEZUUKQ6P |
@alexeagle So I went back in the history to test the behaviour when rules_swc used the Node.js @swc/cli. In general, the Instead, the user should to set the value explicitly by either a) by using the --source-root option as a custom argument, or b) we define a new optional variable in the rule Example
|
The same goes for the source file name, which is the first entry in the Example
|
TAL at #176 which aligns the behavior with |
Seems like the mistake was just that the source-root should have been relative to the rootDir. |
What happened?
When we changed to
swcx
we changed the sourcemaps:https://github.com/aspect-build/rules_swc/blob/main/examples/rc/src/expected.js.map
"sources":["examples/rc/src/in.ts"]
https://github.com/aspect-build/rules_swc/blob/v0.20.1/examples/rc/src/expected.js.map
"sources":["in.ts"]
Version
It changed in the commit where we switched from @swc/cli (the nodejs wrapper) to swcx
https://github.com/aspect-build/rules_swc/commit/6358e06ac2a8d6aca2c2ea0cd6ea9dc7b9217a27#diff-90f27955a28ad20f91303a[…]4c55c9ef8b0ccb3255a1bdd1f726
The text was updated successfully, but these errors were encountered: