tsconfig-paths
tsconfig-paths copied to clipboard
Better way to expose `tsconfig.json`
Hey! I just wanted to check in and see if there's a better way I can expose tsconfig.json content to you from ts-node. This should be applicable to other implementations too. Partially relevant to https://github.com/TypeStrong/ts-node/issues/409, where I'll likely need to provide something globally to identify if ts-node is loaded with the same configuration already. Ideas:
- Expose something on some part of the node.js global (e.g.
process.ts,global.ts, etc)
- Originally I wanted to use symbols, but that might make it harder for you to access - you'd need to wrap
require('ts-node').TS_SYMBOLin atry..catch
- Expose something as part of the
ts-nodemodule (e.g.require('ts-node').instance)
- This would hide any internals from others, such as symbols and such
To me (1) looks like the most straightforward approach. For example we could check if global.tsconfig exists and then use that, and otherwise fall back to our current approach. This would also enable anyone to set this so it would not be specific to ts-node.