diff --git a/packages/nx/src/utils/nx-plugin.ts b/packages/nx/src/utils/nx-plugin.ts index 92fa396d59620..883e49f9328d4 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 }; }