-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
lambda-nodejs: NodejsFunction not ignoring noEmit in tsconfig when pre-compiling #25603
Comments
Thank you for your report. We appreciate your time and PR and would be happy to review it when it's ready. |
) When building the options to `tsc` for pre-compilation from tsconfig, exclude any `noEmit` compiler option in case it has been set to `true`, which would prevent generation of the compiled .js files. Added `'noEmit'` to the list of excluded options when processing tsconfig. Closes #25603. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Hello @pahud and @leestkly , this still appears to be an issue, even though the release notes mention that this was fixed in V2.83.0. We are currently using V2.85.0 and have also tried V2.68.0, with |
Yes having the same issue at the moment
|
Describe the bug
When using the
preCompilation: true
bundling option toNodejsFunction
with a tsconfig that contains the compiler option"noEmit": true
, no compiled .js files are generated by the pre-compilation step before bundling. This may causeesbuild
to bundle the original .ts files instead, which is not the intended outcome when using pre-compilation.Some projects may enable
noEmit
in their tsconfig so that they can usetsc
to perform type checking without generating needless output files, sinceNodejsFunction
will do that automatically as part of pre-compilation during deployment.When
NodejsFunction
builds thetsc
options from the tsconfig for pre-compilation, it should ignore anynoEmit
compiler option so that output files will always be generated.Expected Behavior
A setting of
"noEmit": true
in tsconfig has no effect on the pre-compilation behavior ofNodejsFunction
. Pre-compilation will still output the compiled .js files before bundling.Current Behavior
A setting of
"noEmit": true
in tsconfig prevents the pre-compilation option ofNodejsFunction
from working correctly, as no .js files are generated. In this case,esbuild
bundles the original .ts files, which is not the desired outcome.Reproduction Steps
Using a
tsconfig.json
such as:with a
NodejsFunction
such as:will show this issue, where no pre-compiled .js files are generated.
Possible Solution
Add
'noEmit'
to theexcludedCompilerOptions
in thegetTsconfigCompilerOptions()
utility function.Additional Information/Context
No response
CDK CLI Version
2.79.1 (build 2e7f8b7)
Framework Version
No response
Node.js Version
v18.16.0
OS
macOS 12.6.5
Language
Typescript
Language Version
Typescript (5.0.4)
Other information
No response
The text was updated successfully, but these errors were encountered: