From fa40367f2fe845de5b5bf8cc57b9fbd41e9b373f Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Mon, 17 Apr 2023 10:18:42 -0400 Subject: [PATCH] fix(core): use the module name as the name of the nx plugin (#16335) --- packages/nx/src/utils/nx-plugin.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/nx/src/utils/nx-plugin.ts b/packages/nx/src/utils/nx-plugin.ts index 92fa396d59..883e49f932 100644 --- a/packages/nx/src/utils/nx-plugin.ts +++ b/packages/nx/src/utils/nx-plugin.ts @@ -80,11 +80,12 @@ function getPluginPathAndName( } } const packageJsonPath = path.join(pluginPath, 'package.json'); + const { name } = !['.ts', '.js'].some((x) => x === path.extname(pluginPath)) && // 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: path.basename(pluginPath) }; // use the name of the file we point to + : { name: moduleName }; return { pluginPath, name }; }