https://pulumi.com logo
#general
Title
# general
l

limited-art-90541

02/06/2024, 4:24 PM
While running
pulumi preview|up
is there a way to specify which typescript compiler to use? I am trying to get a somewhat unorthodox setup to work where I have one JS package, with multiple pulumi projects, ie:
Copy code
root/
  tsconfig.json
  package.json
  node_modules/
    .bin/
      tsc
  project-a/
    Pulumi.yaml
    index.ts
  project-b/
    Pulumi.yaml
    index.ts
When I compile the project using the
tsc
found in the root node_modules it compiles successfully. When I run
pulumi preview
it fails to compile, and my dynamic providers aren't compiled with the target I specify in my
tsconfig
. TLDR; Is it possible to use the typescript configuration that is defined in a parent folder?
I have figured out that it is just not picking up my tsconfig path and that I can set it via the environment variable:
PULUMI_NODEJS_TSCONFIG_PATH
Is there a way to set this in my project configuration or I need to export this in my shell everytime I work with pulumi?
i

icy-controller-6092

02/06/2024, 5:55 PM
runtime: name: nodejs options: typescript: false nodeargs: --import tsx/esm
This will replace Pulumi typescript compiler (TS-node) with the much better & faster tsx compiler
It will find your tsconfig.json automatically
I’ve also done a lot of work getting multiple Pulumi projects setup in an nx monorepo, happy to look into any code you might have
l

limited-art-90541

02/06/2024, 6:11 PM
Hi Matt. This is very interesting, but a little new to me so I am not sure I understand the solution. I am using a locally installed dev dependency to check my typescript files and run
tsc -w --noEmit
at the root folder. I don't mind trying tsx/esm but will it find my tsc version? Or will it use a different compiler? Any context would be appreciated
Ok I am seeing it uses esbuild under the hood to strip the typescript, and so its on me to do the typechecking locally correct?