Skip to content

Commit

Permalink
fix(core): register ts transpiler when running .ts backed plugins (#1…
Browse files Browse the repository at this point in the history
…9027)

(cherry picked from commit 2526967)
  • Loading branch information
AgentEnder authored and FrozenPandaz committed Sep 7, 2023
1 parent 1f10398 commit 22dadbc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/nx/src/utils/nx-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,16 @@ function getPluginPathAndName(
}
const packageJsonPath = path.join(pluginPath, 'package.json');

const extension = path.extname(pluginPath);

// Register the ts-transpiler if we are pointing to a
// plain ts file that's not part of a plugin project
if (extension === '.ts' && !tsNodeAndPathsRegistered) {
registerPluginTSTranspiler();
}

const { name } =
!['.ts', '.js'].some((x) => x === path.extname(pluginPath)) && // Not trying to point to a ts or js file
!['.ts', '.js'].some((x) => x === extension) && // Not trying to point to a ts or js file
existsSync(packageJsonPath) // plugin has a package.json
? readJsonFile(packageJsonPath) // read name from package.json
: { name: moduleName };
Expand Down

0 comments on commit 22dadbc

Please sign in to comment.