Skip to content

Commit

Permalink
chore(core): use ts-node instead of swc-node for resolving nx plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Feb 25, 2022
1 parent 5b08f31 commit f1b9ae3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
8 changes: 1 addition & 7 deletions packages/tao/package.json
Expand Up @@ -30,7 +30,7 @@
},
"homepage": "https://nx.dev",
"dependencies": {
"@swc-node/register": "^1.4.2",
"ts-node": "9.1.1",
"tsconfig-paths": "^3.9.0",
"chalk": "4.1.0",
"enquirer": "~2.3.6",
Expand All @@ -44,11 +44,5 @@
"tmp": "~0.2.1",
"tslib": "^2.3.0",
"yargs-parser": "20.0.0"
},
"optionalDependencies": {
"@swc/core-linux-x64-musl": "^1.2.136",
"@swc/core-linux-x64-gnu": "^1.2.136",
"@swc/core-linux-arm64-gnu": "^1.2.136",
"@swc/core-linux-arm64-musl": "^1.2.136"
}
}
9 changes: 4 additions & 5 deletions packages/tao/src/shared/nx-plugin.ts
@@ -1,8 +1,7 @@
import { sync } from 'fast-glob';
import { existsSync } from 'fs';
import * as path from 'path';
import { register } from '@swc-node/register/register';
import { readDefaultTsConfig } from '@swc-node/register/read-default-tsconfig';
import { register } from 'ts-node';

import { appRootPath } from '../utils/app-root';
import { readJsonFile } from '../utils/fileutils';
Expand Down Expand Up @@ -156,10 +155,10 @@ export function resolveLocalNxPlugin(
let tsNodeAndPathsRegistered = false;
function registerTSTranspiler() {
try {
const tsConfigOptions = readDefaultTsConfig(
const { compilerOptions } = readJsonFile(
path.join(appRootPath, 'tsconfig.base.json')
);
register(tsConfigOptions);
register({ compilerOptions, typeCheck: false });

const tsconfigPaths: typeof import('tsconfig-paths') = require('tsconfig-paths');

Expand All @@ -169,7 +168,7 @@ function registerTSTranspiler() {
*/
return tsconfigPaths.register({
baseUrl: appRootPath,
paths: tsConfigOptions.paths,
paths: compilerOptions.paths,
});
} catch (err) {}
}
Expand Down

0 comments on commit f1b9ae3

Please sign in to comment.