Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When used with ts-node, tsconfig-paths should use the same tsconfig.json as ts-node when autodiscovering #238

Open
rhyek opened this issue Feb 1, 2023 · 1 comment

Comments

@rhyek
Copy link

rhyek commented Feb 1, 2023

Hello. Not sure what project would need to support this, so I am linking to the issue in ts-node: TypeStrong/ts-node#1948

@rhyek rhyek changed the title When used with ts-node, tsconfig-paths should the same tsconfig.json as ts-node when autodiscovering When used with ts-node, tsconfig-paths should use the same tsconfig.json as ts-node when autodiscovering Feb 1, 2023
@rhyek
Copy link
Author

rhyek commented Feb 1, 2023

FYI my current workaround:

#!/usr/bin/env ts-node --transpileOnly
import execa from 'execa';
import * as ts from 'typescript';

const entrypoint = process.argv[2];
const configFile = ts.findConfigFile(entrypoint, ts.sys.fileExists);

const args = process.argv.slice(3);

void (async () => {
  await execa(
    '/usr/bin/env',
    [
      'ts-node',
      ...(configFile
        ? ['--project', configFile, '--require', 'tsconfig-paths/register']
        : []),
      entrypoint,
      ...args,
    ],
    {
      stdio: 'inherit',
    },
  );
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant