https://pulumi.com logo
#typescript
Title
# typescript
m

millions-journalist-34868

06/25/2023, 8:00 PM
Hi, it might be a stupid question but any way to do top level await in a pulumi program (index.ts file). It compiles fine but failed when running it with pulumi up
l

little-cartoon-10569

06/25/2023, 8:21 PM
I think you just need to set your Typescript target and module values to whatever's required for that. IIRC is might be esnext and es2018, or newer?
m

millions-journalist-34868

06/25/2023, 8:23 PM
It's what I did, it made the code compile on vscode. But failed when running pulumi up
l

little-cartoon-10569

06/25/2023, 9:19 PM
Ah yes, you need to override Pulumi's configuration, I forgot that part. Onesec I'll get the link
The link is here: https://www.pulumi.com/docs/languages-sdks/javascript/#disabling-built-in-typescript-support However I've just checked in some of my projects and I don't use that. Apparently this also works:
Copy code
runtime:
  name: nodejs
  options:
    nodeargs: "--loader ts-node/esm --no-warnings"
m

millions-journalist-34868

06/26/2023, 2:27 PM
nice, thanks!
2 Views