From 23ac3854817728d5d69148ad7fc95af216105704 Mon Sep 17 00:00:00 2001 From: Noah Gao Date: Thu, 20 Jul 2023 21:16:51 +0800 Subject: [PATCH] fix(plugin): add artus dir to package path resolver for pnpm --- src/plugin/common.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugin/common.ts b/src/plugin/common.ts index b1f5bca..58638d7 100644 --- a/src/plugin/common.ts +++ b/src/plugin/common.ts @@ -35,9 +35,11 @@ export function topologicalSort(pluginInstanceMap: Map, plug } // A util function of get package path for plugin -export function getPackagePath(packageName: string, paths?: string[]): string { - const opts = paths ? { paths } : undefined; - return path.resolve(require.resolve(packageName, opts), '..'); +export function getPackagePath(packageName: string, paths: string[] = []): string { + const opts = { + paths: paths.concat(__dirname), + }; + return path.dirname(require.resolve(packageName, opts)); } export async function getInlinePackageEntryPath(packagePath: string): Promise {