From 6246b3f3c5ac4b67c71dc382a58b50d52dcd4484 Mon Sep 17 00:00:00 2001 From: yehuozhili <673632758@qq.com> Date: Wed, 19 May 2021 10:20:05 +0800 Subject: [PATCH] fix:path may not find when use lerna MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 当使用lerna 将nodemodule提取到根目录时,该插件调用的nodemodule的位置如果没有存在nodemodule文件夹则会报错,所以使用相对路径找到该插件所安装位置确保肯定存在nodemodule --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 86dab96..e64c283 100644 --- a/src/index.ts +++ b/src/index.ts @@ -64,7 +64,7 @@ export default function (api: IApi) { } const { cwd, absOutputPath, absNodeModulesPath } = api.paths; const outputPath = absOutputPath; - const themeTemp = winPath(join(absNodeModulesPath, '.plugin-theme')); + const themeTemp = winPath(join(__dirname, '../../.plugin-theme')); // 增加中间件 api.addMiddewares(() => {