diff --git a/libs/wingsdk/src/shared/sandbox.ts b/libs/wingsdk/src/shared/sandbox.ts index f8f2739a5a8..a3c0b866c71 100644 --- a/libs/wingsdk/src/shared/sandbox.ts +++ b/libs/wingsdk/src/shared/sandbox.ts @@ -37,7 +37,7 @@ export class Sandbox { entrypoint: string, log?: (message: string) => void ): Promise { - let contents = (await readFile(entrypoint)).toString(); + let contents = await readFile(entrypoint, "utf-8"); // log a warning if contents includes __dirname or __filename if (contents.includes("__dirname") || contents.includes("__filename")) { @@ -48,9 +48,7 @@ export class Sandbox { // wrap contents with a shim that handles the communication with the parent process // we insert this shim before bundling to ensure source maps are generated correctly - contents = ` -"use strict"; -${contents} + contents += ` process.on("message", async (message) => { const { fn, args } = message; try {