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
  • Loading branch information
AgentEnder committed Sep 6, 2023
1 parent f30174b commit 2526967
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 2526967

Please sign in to comment.