Skip to content

Commit

Permalink
fix: remove empty export from transpiled ts file (#1471)
Browse files Browse the repository at this point in the history
  • Loading branch information
John98Zakaria committed Mar 29, 2024
1 parent 2ac3b5f commit 536c665
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/client/setup/code-runners.ts
Expand Up @@ -144,9 +144,13 @@ export async function runJavaScript(code: string): Promise<CodeRunnerOutputs> {
return textRep
}

// The reflect-metadata runtime is available, so allow that to go through
function sanitizeJS(code: string) {
return code.replace(`import "reflect-metadata"`, '').replace(`require("reflect-metadata")`, '')
// The reflect-metadata runtime is available, so allow that to go through
code = code.replace(`import "reflect-metadata"`, '').replace(`require("reflect-metadata")`, '')
// Transpiled typescript sometimes contains an empty export, remove it.
code = code.replace('export {};', '')

return code
}

return allLogs
Expand Down

0 comments on commit 536c665

Please sign in to comment.