-
-
Notifications
You must be signed in to change notification settings - Fork 534
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
[swc] Allow keepClassNames
configuration, or default to true
#1343
Comments
Thank you for the detailed report. Your proposed option 1. seems the easiest for everyone. Are there any situations where a user would want to disable If we need to implement option 2, I think we can support it like this. The example below does not work today, but the necessary code change is small. // tsconfig.json
{
"ts-node": {
// This is undocumented, but transpilers can accept an options object
"transpiler": ["ts-node/transpilers/swc-experimental", {
"jsc": {
"keepClassNames": true
}
}]
}
} |
In the swc docs I see this:
But that is no problem; we can automatically set it to |
I can't think of a case where one would not want to keep class names – other than maybe performance impact at the swc-transpilation level if they're doing extra processing. Solution 1. feels like a good path forward and I like the idea of setting the flag automatically depending on target. |
Ok, I don't think anyone will notice a couple extra processor cycles in rust. Thank you for the quick reply. I created a fix in #1344. I need to add tests before I can merge and publish to npm, but in the meantime, I included installation instructions on the pull request so you can test it today. |
Desired Behavior
In https://github.com/TypeStrong/ts-node/blob/main/src/transpilers/swc.ts#L57-L88 there is no reference to keepClassNames which is required for popular libraries like TypeORM to work.
Proposal is to either:
jsc.keepClassNames = true
by defaultkeepClassNames
somehow (maybe ints-node.compilerOptions.keepClassNames
)Is this request related to a problem?
With ts-node v10 and swc 1.2.58, running typeorm migrations result in this kind of error:
This is what
keepClassNames
is for: swc-project/swc#1279The text was updated successfully, but these errors were encountered: