Skip to content

Commit

Permalink
fix(core): use located tsconfig name for tsconfig-paths when register…
Browse files Browse the repository at this point in the history
…ing local plugin transpiler (#16476)

(cherry picked from commit 0e68441)
  • Loading branch information
AgentEnder authored and FrozenPandaz committed Apr 25, 2023
1 parent ddbf33b commit 2742ed1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/nx/src/utils/nx-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,16 +257,18 @@ export function registerPluginTSTranspiler() {
if (!tsNodeAndPathsRegistered) {
// nx-ignore-next-line
const ts: typeof import('typescript') = require('typescript');
const tsConfigName = existsSync('tsconfig.base.json')
? 'tsconfig.base.json'
: existsSync('tsconfig.json')
? 'tsconfig.json'
: null;

// Get the first tsconfig that matches the allowed set
const tsConfigName = [
join(workspaceRoot, 'tsconfig.base.json'),
join(workspaceRoot, 'tsconfig.json'),
].find((x) => existsSync(x));

const tsConfig: Partial<ts.ParsedCommandLine> = tsConfigName
? readTsConfig(tsConfigName)
: {};

registerTsConfigPaths(join(workspaceRoot, 'tsconfig.base.json'));
registerTsConfigPaths(tsConfigName);
registerTranspiler({
experimentalDecorators: true,
emitDecoratorMetadata: true,
Expand Down

0 comments on commit 2742ed1

Please sign in to comment.