-
Notifications
You must be signed in to change notification settings - Fork 4.4k
(aws-lambda-nodejs): esbuild does not support emitting typescript decorator metadata #13767
Description
Somewhere in the recent version of 'aws-lambda-nodejs' module, the default bundler for aws-lambda-nodejs was changed from 'parcel' to 'esbuild'. Bundling performance has improved greatly but all my handlers are broken now (all the ones that were relying on ts metadata reflaction).
This has to do with how esbuild transpiles typescript code, as stated here by the author of esbuild, emitDecoratorMetadata is not and will not be supported by esbuild, but this would break all other libraries that rely on the availability of run time metadata.
like: TypeORM, TypeDORM, Nestjs.
I think aws-lambda-nodejs should auto handle pre-transpiling files with decorators using tsc and later continue with esbuild. (Similar suggested by the author of esbuild too.)
Reproduction Steps
Trying to bundle a simple nodejs project using Reflect metadata api should demonstrate the problem.
What did you expect to happen?
when bundling code with aws-lambda-nodejs decorator metadata should be reflected properly.
What actually happened?
Decorator metadata is not reflected in the fine js bundle.
If this is something aws-lambda-nodejs should handle, I can do a PR.
Environment
- **CDK CLI Version :1.91
- **Framework Version:1.91
- **Node.js Version:14.15
- **OS :linux
- **Language (Version):TypeScript (3.9.9)
This is 🐛 Bug Report