-
-
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
Broken codegen of class with decorated method when using jsc.module.lazy
#1135
Comments
As you used class MyClass extends _module.Class {
async method() {
}
} |
Yep, that's how it should be. It's correctly emitted as That also happens to be the only difference between the outputs ( 29c29
< class MyClass extends _module().Class {
---
> class MyClass extends _module.Class { |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Describe the bug
Edit: I've used
module
as an example of an external module below, but I've now realized that it might be confused with themodule
Node builtin. The issue exists no matter what name the external module has.Codegen breaks when all of the conditions below are met:
jsc.module.type
has to be set tocommonjs
.jsc.module.lazy
has to be set totrue
.Input code
Config
Emitted code
Expected behavior
The emitted code includes
class MyClass extends _module().Class
. Note the_module()
call, which shouldn't happen, as_module
is assigned the required module which isn't callable. This leads to a runtime error (TypeError: _module is not a function
).Version
The version of @swc/core:
1.2.35
Additional context
This issue doesn't exist when
jsc.module.lazy
is set tofalse
.The text was updated successfully, but these errors were encountered: