@@ -280,7 +280,10 @@ export class CdkFramework implements IFramework {
280280 contents = fileContent ;
281281 }
282282
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 ) ;
284287
285288 // Inject code to get the file path of the Lambda function and CDK hierarchy
286289 if ( args . path . includes ( 'aws-cdk-lib/aws-lambda/lib/function.' ) ) {
@@ -309,12 +312,12 @@ export class CdkFramework implements IFramework {
309312 };
310313
311314 // 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+ // });
318321 global.lambdas.push(lambdaInfo);` + codeToFind ,
319322 ) ;
320323 }
0 commit comments