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

billowy-laptop-45963

08/08/2019, 6:28 PM
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

white-balloon-205

08/08/2019, 6:29 PM
What exactly do you mean by "not picking up my tsconfig.json paths"? What error do you get?
b

billowy-laptop-45963

08/08/2019, 6:30 PM
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

white-balloon-205

08/08/2019, 6:36 PM
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

billowy-laptop-45963

08/08/2019, 6:37 PM
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

white-balloon-205

08/08/2019, 9:53 PM
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.
27 Views