[BUG] Loading TS config files when `--experimental-strip-types` is enabled still requires `ts-node` · Issue #914 · node-config/node-config · GitHub
Skip to content

[BUG] Loading TS config files when --experimental-strip-types is enabled still requires ts-node #914

Description

@satazor

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions