Skip to content

Commit f4f72c8

Browse files
committed
Use js loader for cjs files
1 parent f039636 commit f4f72c8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/frameworks/cdkFramework.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,9 @@ export class CdkFramework implements IFramework {
283283
// for .mjs files, use js loader
284284
const fileExtension = args.path.split('.').pop();
285285
const loader: esbuild.Loader =
286-
fileExtension === 'mjs' ? 'js' : (fileExtension as esbuild.Loader);
287-
286+
(fileExtension === 'mjs' || fileExtension === 'cjs')
287+
? 'js'
288+
: (fileExtension as esbuild.Loader);
288289
// Inject code to get the file path of the Lambda function and CDK hierarchy
289290
if (args.path.includes('aws-cdk-lib/aws-lambda/lib/function.')) {
290291
const codeToFind =

0 commit comments

Comments
 (0)