-
-
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
Disable define/set issue transform for targets with native class properties support #9743
Comments
There are two bugs here, one for documentation and one for the default value of the {
"jsc": {
"assumptions": {
"setPublicClassFields": false
}
} will disable the problematic behavior. However, assumptions API is not well documented, and @magic-akari Do you think we should adjust the default value of assumptions based on the target. |
loose
transpiles class properties
The As for whether assumptions differ based on targets in loose mode, I don't have a clear idea, but we can look to Babel's implementation for guidance. If we decide to proceed, we'll need to make adjustments in our code. Many of our transformation passes directly pass |
Describe the bug
When
env.targets
targets an environment with support for class properties, SWC will still transpile in aconstructor
implementation.This is problematic since throwing an error from the parent class constructor would create a stackframe that can't be fully sourcemapped since the
super(...args)
call in the generated code does not appear in the original code.Alternatively, #9742 would fix the main motivation for this ticket.
Input code
Config
Playground link (or link to the minimal reproduction)
https://play.swc.rs/?version=1.9.2&code=H4sIAAAAAAAAA0vOSSwuVnDLz1dIrShJzUspVnBKLFKo5lJQyEjMS8lJDU4uys%2FJUbBV0NBUsLVTqK7lqgUAn5sc8jMAAAA%3D&config=H4sIAAAAAAAAA1WOTQrDIBBG955CZl0K2ZRQaG%2FQQ4iZBEP8wTGlEnL3GBttupv5nvP8FsY5jCThzpc0psUJT%2BjrnhKKJohPSgClFiS9cgEuhY60o15MhDlavwQmawkTCX7GI9LKqD6e1dJq55GoGKpVCzNM%2BC9mhxy07eYMj8ohOsz16Aa%2FR%2BWzKgZFr3JZWgGa90kk%2FIBhbwPGdsifD96016bNVrZud4rKzC0BAAA%3D
SWC Info output
No response
Expected behavior
Input code is not modified.
Actual behavior
Transpiled code contains
super(...args)
call that can't be sourcemapped to original code due to #9742.Version
1.9.2
Additional context
No response
The text was updated successfully, but these errors were encountered: