Closed 0x80 closed 2 years ago
Nevermind! I got it to work.
I was stupid enough to copy the clean()
call from the example, which voids the code above it 😄 🤦♂️
My bootstrap file is now:
const tsConfigPaths = require("tsconfig-paths");
const baseUrl = "dist";
tsConfigPaths.register({
baseUrl,
paths: {
"~/*": ["./*"],
},
});
I am compiling my code to
dist
with the following paths configuration in tsconfig.json:I tried to use the bootstrapping instructions but I couldn't get it to resolve paths from my dist directory. I think I've tried about every combination of paths and baseUrl imaginable, so I think it's not working (as intended).
Luckily I have found a workaround. I created a file
tsconfig.run.json
next to my originaltsconfig.json
with the following contents:And now I can run the code from the dist output like this:
The instructions in the readme about configuring the tsconfig with
-P
or--project
seem confusing/misleading because this is an option for ts-node. It's not something that node supports.And I guess the variable
TS_NODE_PROJECT
is better renamed to something that is not ts-node specific since I'm using it here outside of that context. Maybe something likeTS_CONFIG_FILE
would be better.