Skip to content

Commit 2df60f9

Browse files
Merge pull request #91 from ServerlessLife/89-loading-cjs-files
fix #89: Use js loader for cjs files in CDK
2 parents f039636 + 8dbd7fe commit 2df60f9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ If you have a new feature idea, please create and issue.
332332
- [Roger Chi](https://rogerchi.com/)
333333
- [Sebastian / avocadomaster](https://github.com/avocadomaster)
334334
- [Sebastian Bille](https://blog.sebastianbille.com)
335+
- [Spotchi](https://github.com/Spotchi)
335336
- ⭐ Your name here for notable code or documentation contributions or sample projects submitted with a bug report that resulted in tool improvement.
336337

337338
## Disclaimer

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)