pulumi up does not seem to be picking up my tsconf...
# general
b
pulumi up does not seem to be picking up my tsconfig.json paths. I also have ts-mocha setup and it picks up the paths. Is there something special I have to do?
w
What exactly do you mean by "not picking up my tsconfig.json paths"? What error do you get?
b
Error: Cannot find module ...
I added to tsconfig.json:
Copy code
"baseUrl": ".",
"paths": { "mypath/*": ["src/*"] }
and in index.ts:
Copy code
import { something } from "mypath/abc"
and in my mocha tests the import works confirming the tsconfig.json is being used
w
Hmm - interesting - I've never used these properties in
tsconfig
. We use https://github.com/TypeStrong/ts-node under the hood to do the TypeScript compilation - so Pulumi will behave as defined there in terms of how
tsconfig
is interpreted for TS compilation/loading. If you do need to take control of this yourself (doing
tsc
manually instead of relying on
ts-node
) see https://www.pulumi.com/docs/reference/javascript/#disabling-built-in-typescript-support.
b
I figured I could use the tsconfig paths to namespace code to make it easier to refactor later instead of using relative paths
ok I think under the hood ts-mocha uses tsconfig-paths module and I got ts-node to work by
-r tsconfig-paths/register
. Can I simply add that requires to the ts-node invocation that happens under the hood?
w
That is interesting. It does look like potentially we should be loading that by default along with
ts-node
. If you want to open an issue and/or PR for this - we can look into that.