Skip to content

Commit

Permalink
fix(core): disable ts-node warning when its using a fast transpiler (#…
Browse files Browse the repository at this point in the history
…12765)

(cherry picked from commit 5ade725)
  • Loading branch information
forivall authored and FrozenPandaz committed Nov 7, 2022
1 parent 4169a7e commit ba7a850
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/nx/src/utils/register.ts
Expand Up @@ -36,18 +36,21 @@ export const registerTsProject = (
// We can fall back on ts-node if its available
const tsNodeInstalled = packageIsInstalled('ts-node/register');
if (tsNodeInstalled) {
warnTsNodeUsage();
const { register } = require('ts-node') as typeof import('ts-node');

// ts-node doesn't provide a cleanup method
registerTranspiler = () => {
register({
const service = register({
project: tsConfigPath,
transpileOnly: true,
compilerOptions: {
module: 'commonjs',
},
});
// Don't warn if a faster transpiler is enabled
if (!service.options.transpiler && !service.options.swc) {
warnTsNodeUsage();
}
return () => {};
};
}
Expand Down

0 comments on commit ba7a850

Please sign in to comment.