Skip to content

Commit 5de7b86

Browse files
authored
fix(lambda-nodejs): local tsc detection with pre compilation (#19266)
The package name is `typescript`, the bin is `tsc`. Closes #19242 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent b3c5fe8 commit 5de7b86

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/@aws-cdk/aws-lambda-nodejs/lib/bundling.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class Bundling implements cdk.BundlingOptions {
8989
this.packageManager = PackageManager.fromLockFile(props.depsLockFilePath, props.logLevel);
9090

9191
Bundling.esbuildInstallation = Bundling.esbuildInstallation ?? PackageInstallation.detect('esbuild');
92-
Bundling.tscInstallation = Bundling.tscInstallation ?? PackageInstallation.detect('tsc');
92+
Bundling.tscInstallation = Bundling.tscInstallation ?? PackageInstallation.detect('typescript');
9393

9494
this.projectRoot = props.projectRoot;
9595
this.relativeEntryPath = path.relative(this.projectRoot, path.resolve(props.entry));

packages/@aws-cdk/aws-lambda-nodejs/test/bundling.test.ts

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ beforeEach(() => {
1616
jest.resetAllMocks();
1717
jest.restoreAllMocks();
1818
Bundling.clearEsbuildInstallationCache();
19+
Bundling.clearTscInstallationCache();
1920

2021
jest.spyOn(Code, 'fromAsset');
2122

@@ -602,6 +603,8 @@ test('esbuild bundling with pre compilations', () => {
602603
],
603604
}),
604605
});
606+
607+
expect(detectPackageInstallationMock).toHaveBeenCalledWith('typescript');
605608
});
606609

607610
test('throws with pre compilation and not found tsconfig', () => {

0 commit comments

Comments
 (0)