Describe the bug
When --experimental-strip-types is enabled (enabled by default in recent node versions), loading config files written in TypeScript fail with Error: Cannot find module 'ts-node'.
Expected behavior
Loading TypeScript config files should work out of the box when --experimental-strip-types is enabled. In fact, if I comment this code, I'm able to load config correctly, without the extra dependency.
Parser.tsParser = function(filename, content) {
// if (!require.extensions['.ts']) {
// require(TS_DEP).register({
// lazy: true,
// ignore: ['(?:^|/)node_modules/', '.*(?<!\.ts)$'],
// transpileOnly: true,
// compilerOptions: {
// allowJs: true,
// }
// });
// }
One possible solution is to check process.features.typescript === 'strip', and also skip loading ts-node if it evaluates to true.
Please tell us about your environment:
- node-config version:
4.0.0
- node-version:
24.14.0
Describe the bug
When
--experimental-strip-typesis enabled (enabled by default in recent node versions), loading config files written in TypeScript fail withError: Cannot find module 'ts-node'.Expected behavior
Loading TypeScript config files should work out of the box when
--experimental-strip-typesis enabled. In fact, if I comment this code, I'm able to load config correctly, without the extra dependency.One possible solution is to check
process.features.typescript === 'strip', and also skip loadingts-nodeif it evaluates to true.Please tell us about your environment:
4.0.024.14.0