This message was deleted.
# typescript
s
This message was deleted.
b
there isn't enough informatio here I'm afraid, how is your repo laid out?
p
Im using a https://nx.dev/ monorepo I colocated my React App and my Pulumi in the same folder
apps/app-web
and reserved
apps/app-web/src-infra
for pulumi scripts and tsconfig.json I’m trying to load a library of pulumi component resources in
libs/infra
it works with a relative path but not with an absolute path
@app/infra
defined in
tsconfig.json
so
Copy code
apps/app-web/* (react root)
apps/app-web/Pulumi.yaml
apps/app-web/Pulumi.app-web.dev.yaml
apps/app-web/src-infra/main.ts (pulumi script)
apps/app-web/src-infra/tsconfig.json (for pulumi)
libs/infra/src/index.ts (pulumi comp res)
package.json
tsconfig.base.json
I have been able to pass my custom path and baseurl using tsconfig.json in the same folder as my pulumi script. my path are well registered with ts-node and baseurl is correct relative to the script cwd I have printed out this line config: https://github.com/pulumi/pulumi/blob/master/sdk/nodejs/cmd/run/run.ts#L174
Copy code
{
      target: 'es6',
      module: 'commonjs',
      moduleResolution: 'node',
      sourceMap: 'true',
      baseUrl: '../../../',
      paths: {
        '@app/infra': [ 'libs/infra/src/index.ts' ]
      },
      traceResolution: true
    }
it seems like Typescript is finding my import, but I get an error from nodeJS when it tried to load the module
b
sorry I'm not familiar with nx.dev
you do need to run things with the pulumi cli, or use automation API
p
@billowy-army-68599 alright I made it work 🙂 thanks to https://github.com/pulumi/pulumi/issues/3061#issuecomment-822501184
❤️ 1
thank you
130 Views