aws / aws-toolkit-vscode

Amazon Q, CodeCatalyst, Local Lambda debug, SAM/CFN syntax, ECS Terminal, AWS resources
https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode
Apache License 2.0
1.46k stars 401 forks source link

Can the outDir be changed for where the aws-toolkit-tsconfig.json generated Typescript output files go? #4432

Open pr3tori4n opened 6 months ago

pr3tori4n commented 6 months ago

System details (run the AWS: About Toolkit command)

Question

Me and my team are using AWS CDK to define our infrastructure. I've installed SAM CLI and AWS Toolkit in order to locally debug lambda functions in VSCode per guidelines here: https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/setup-toolkit.html https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/serverless-apps-run-debug-no-template.html

I've pretty much gotten it working. But one thing I tried I could not get working, and that was changing the outDir location in the aws-toolkit-tsconfig.json to a subfolder in the project to prevent a bunch of .js and .d.ts files from being added to the project directory.

It would be preferred both from a git management perspective (easy to gitignore) and a cleanup perspective (easy to delete files in the subfolder after the testing is completed). However, if I modfy the outDir using the generated launch.json configuration, I get an error:

 undefined  ERROR   Uncaught Exception  {"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot find module <lambdaFileName>

Any guidance on how to set this up properly would be greatly appreciated.

justinmk3 commented 5 months ago

However, if I modfy the outDir using the generated launch.json configuration, I get an error:

Can you show an example of the exact launch.json config?

You could try setting sam.buildDir in the launch config. https://github.com/aws/aws-toolkit-vscode/blob/721e951fd291aebb47c89754b7314dd36ed01b5b/packages/core/src/shared/sam/debugger/typescriptSamDebug.ts#L190