@@ -280,7 +280,10 @@ export class CdkFramework implements IFramework {
280
280
contents = fileContent ;
281
281
}
282
282
283
- const loader = args . path . split ( '.' ) . pop ( ) as esbuild . Loader ;
283
+ // for .mjs files, use js loader
284
+ const fileExtension = args . path . split ( '.' ) . pop ( ) ;
285
+ const loader : esbuild . Loader =
286
+ fileExtension === 'mjs' ? 'js' : ( fileExtension as esbuild . Loader ) ;
284
287
285
288
// Inject code to get the file path of the Lambda function and CDK hierarchy
286
289
if ( args . path . includes ( 'aws-cdk-lib/aws-lambda/lib/function.' ) ) {
@@ -309,12 +312,12 @@ export class CdkFramework implements IFramework {
309
312
};
310
313
311
314
// console.log("CDK INFRA: ", {
312
- // stackName: lambdaInfo.stackName,
313
- // codePath: lambdaInfo.codePath,
314
- // code: lambdaInfo.code,
315
- // handler: lambdaInfo.handler,
316
- // bundling: lambdaInfo.bundling
317
- // });
315
+ // stackName: lambdaInfo.stackName,
316
+ // codePath: lambdaInfo.codePath,
317
+ // code: lambdaInfo.code,
318
+ // handler: lambdaInfo.handler,
319
+ // bundling: lambdaInfo.bundling
320
+ // });
318
321
global.lambdas.push(lambdaInfo);` + codeToFind ,
319
322
) ;
320
323
}
0 commit comments