-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Cannot run Nest.js app after compiling #666
Comments
Nest.js project was created via default nest-cli |
@techvlad I did some investigation. It seems like the behavior of the swc almost matches it of babel. swc generates var _dec = _common.Module({
imports: [],
controllers: [_appController.AppController],
providers: [_appService.AppService],
});
let AppModule =
_dec(
(_class = (function() {
class AppModule {}
return AppModule;
})()),
) || _class; while babel generates var AppModule =
((_dec = (0, _common.Module)({
imports: [],
controllers: [_app.AppController],
providers: [_app2.AppService],
})),
_dec(
(_class = function AppModule() {
_classCallCheck(this, AppModule);
}),
) || _class); When I changed the output of swc to let AppModule =
_dec(
(_class = (function() {
class AppModule {}
return AppModule;
})()),
) || _class; , it's behavior become exactly same as babel's one. But the same error occurs anyway. Thus, I'm not sure if this is issue of the swc. Is this really a bug of swc? |
Note: tsc generates var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
AppModule = __decorate([
Module({
imports: [],
controllers: [AppController],
providers: [AppService],
})
], AppModule); which reduces to a call to |
NestJS requires I think swc should mimic behavior babel-plugin-decorator-metadata or babel-plugin-transform-typescript-metadata Is there are any plans to implement this? Update: babel-plugin-decorator-metadata looks like it is for new decorators (not legacy, which typescript uses). |
@unlight Of course. Some decorator fixes are wip. |
I've implemented this, but I want some execution test suite. How did you configured nest-cli to use swc? |
nest-cli does not have any compiler options. |
@techvlad Thanks! |
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
swc successful compile Nest.js, but cannot run after compiling
.swcrc
Example repo
The text was updated successfully, but these errors were encountered: