Skip to content

fix #89: Use js loader for cjs files in CDK #91

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

Merged
merged 3 commits into from
Feb 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ If you have a new feature idea, please create and issue.
- [Roger Chi](https://rogerchi.com/)
- [Sebastian / avocadomaster](https://github.com/avocadomaster)
- [Sebastian Bille](https://blog.sebastianbille.com)
- [Spotchi](https://github.com/Spotchi)
- ⭐ Your name here for notable code or documentation contributions or sample projects submitted with a bug report that resulted in tool improvement.

## Disclaimer
Expand Down
5 changes: 3 additions & 2 deletions src/frameworks/cdkFramework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,9 @@ export class CdkFramework implements IFramework {
// for .mjs files, use js loader
const fileExtension = args.path.split('.').pop();
const loader: esbuild.Loader =
fileExtension === 'mjs' ? 'js' : (fileExtension as esbuild.Loader);

fileExtension === 'mjs' || fileExtension === 'cjs'
? 'js'
: (fileExtension as esbuild.Loader);
// Inject code to get the file path of the Lambda function and CDK hierarchy
if (args.path.includes('aws-cdk-lib/aws-lambda/lib/function.')) {
const codeToFind =
Expand Down
Loading