Skip to content

Commit 80ec50b

Browse files
fix: finding path of aws-cdk-lib module
1 parent fc8e561 commit 80ec50b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/frameworks/cdkFrameworkWorker.mjs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ parentPort.on("message", async (data) => {
2222
// execute code to get the data into global.lambdas
2323
const codeFile = await fs.readFile(data.compileOutput, "utf8");
2424

25-
fixCdkPaths();
25+
await fixCdkPaths(workerData.awsCdkLibPath);
2626

2727
eval(codeFile);
2828

@@ -54,12 +54,11 @@ parentPort.on("message", async (data) => {
5454
/**
5555
* Some paths are not resolved correctly in the CDK code, so we need to fix them
5656
*/
57-
function fixCdkPaths() {
58-
//const path = require("path"); // leave this line for manual debugging
57+
async function fixCdkPaths(awsCdkLibPath) {
58+
// leave this lines for manual debugging
59+
//const awsCdkLibPath = path.resolve("node_modules/aws-cdk-lib");
60+
//const path = require("path");
5961

60-
// Get the path to the aws-cdk-lib module
61-
let awsCdkLibPath = require.resolve("aws-cdk-lib");
62-
awsCdkLibPath = awsCdkLibPath.replace("/index.js", "");
6362
Logger.verbose(`[CDK] [Worker] aws-cdk-lib PATH ${awsCdkLibPath}`);
6463

6564
const pathsFix = {

0 commit comments

Comments
 (0)