From 019a051c4bf03f4469a6564ff6c7adba8e068f3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20S=C3=A1nchez?= Date: Fri, 31 May 2019 15:16:28 -0500 Subject: [PATCH] feat(yarn): Support yarn hoisted packages in a workspace context --- lib/services/plugins-service.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/services/plugins-service.ts b/lib/services/plugins-service.ts index 857e05dbbc..3f10d75b8e 100644 --- a/lib/services/plugins-service.ts +++ b/lib/services/plugins-service.ts @@ -47,7 +47,7 @@ export class PluginsService implements IPluginsService { } const name = (await this.$packageManager.install(plugin, projectData.projectDir, this.npmInstallOptions)).name; - const pathToRealNpmPackageJson = path.join(projectData.projectDir, "node_modules", name, "package.json"); + const pathToRealNpmPackageJson = this.getPackageJsonFilePathForModule(name, projectData.projectDir); const realNpmPackageJson = this.$fs.readJson(pathToRealNpmPackageJson); if (realNpmPackageJson.nativescript) { @@ -228,7 +228,10 @@ export class PluginsService implements IPluginsService { } private getPackageJsonFilePathForModule(moduleName: string, projectDir: string): string { - return path.join(this.getNodeModulesPath(projectDir), moduleName, "package.json"); + const pathToJsonFile = require.resolve(`${moduleName}/package.json`, { + paths: [projectDir] + }); + return pathToJsonFile; } private getDependencies(projectDir: string): string[] {