Skip to content

Commit f6f7a8e

Browse files
committed
feat(yarn): Support yarn hoisted packages in a workspace context
1 parent bb75dbb commit f6f7a8e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/services/plugins-service.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export class PluginsService implements IPluginsService {
4747
}
4848

4949
const name = (await this.$packageManager.install(plugin, projectData.projectDir, this.npmInstallOptions)).name;
50-
const pathToRealNpmPackageJson = path.join(projectData.projectDir, "node_modules", name, "package.json");
50+
const pathToRealNpmPackageJson = this.getPackageJsonFilePathForModule(name, projectData.projectDir);
5151
const realNpmPackageJson = this.$fs.readJson(pathToRealNpmPackageJson);
5252

5353
if (realNpmPackageJson.nativescript) {
@@ -228,7 +228,10 @@ export class PluginsService implements IPluginsService {
228228
}
229229

230230
private getPackageJsonFilePathForModule(moduleName: string, projectDir: string): string {
231-
return path.join(this.getNodeModulesPath(projectDir), moduleName, "package.json");
231+
const pathToJsonFile = require.resolve(`${moduleName}/package.json`, {
232+
paths: [projectDir]
233+
});
234+
return pathToJsonFile;
232235
}
233236

234237
private getDependencies(projectDir: string): string[] {

0 commit comments

Comments
 (0)