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

Allow to specify a different tsconfig.json #10

Closed
meriturva opened this issue Jan 15, 2022 · 3 comments
Closed

Allow to specify a different tsconfig.json #10

meriturva opened this issue Jan 15, 2022 · 3 comments

Comments

@meriturva
Copy link

As already implemented on https://github.com/TypeStrong/ts-node#tsconfig

Basically, we have to change the target used on a few ts files to 'es2020' but our main project still on 'es2017'.

Thanks.

@exrhizo
Copy link

exrhizo commented Jan 23, 2022

implemented on esbuild as well:
evanw/esbuild#226

  --tsconfig=...            Use this tsconfig.json file instead of other ones

@exrhizo
Copy link

exrhizo commented Jan 24, 2022

Okay, for my use case I created:

> node ./scripts/tsrun.mjs ./scripts/rmrf.ts

import { Runner } from '@digitak/esrun';

// Compile and run a ts script.
// We like our esnext, so this file was needed to
// set a custom tsconfig.

const { argv } = process;
const CUSTOM_TSCONFIG_FILE = 'tsconfig.esrun.json';

async function run() {
  let argsOffset = 2;

  const runner = new Runner(argv[argsOffset], {
    args: argv.slice(argsOffset + 1),
  });

  try {
    await runner.build({
      tsconfig: CUSTOM_TSCONFIG_FILE,
    });

    const status = await runner.execute();
    console.log('done executing', status);
    process.exit(status);
  } catch (error) {
    console.error(error);
    process.exit(1);
  }
}

console.log('hiya');
(async function () {
  await run();
})();

@Gin-Quin
Copy link
Contributor

Done since 3.2.5

Use it like this:

esrun --tsconfig:/path/to/tsconfig.json myFile.ts

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

3 participants