From 2dbaf8a1b95857056a9ae31bef3ba729d75e1216 Mon Sep 17 00:00:00 2001 From: chenshuai2144 Date: Thu, 12 Mar 2020 18:33:03 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20bug:=20fix=20absOutputPath=20and?= =?UTF-8?q?=20onBuildComplete=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index f57699d..0822a48 100644 --- a/src/index.ts +++ b/src/index.ts @@ -31,7 +31,7 @@ export default function(api: IApi) { options = require(themeConfigPath); } const { cwd, absOutputPath, absNodeModulesPath } = api.paths; - const outputPath = winPath(join(cwd, absOutputPath)); + const outputPath = absOutputPath; const themeTemp = winPath(join(absNodeModulesPath, '.plugin-theme')); // 增加中间件 @@ -41,12 +41,14 @@ export default function(api: IApi) { // 增加一个对象,用于 layout 的配合 api.addHTMLHeadScripts(() => [ - `window.umi_plugin_ant_themeVar = ${JSON.stringify(options.theme)}`, + { + content: `window.umi_plugin_ant_themeVar = ${JSON.stringify(options.theme)}`, + }, ]); // 编译完成之后 - api.onBuildComplete(error => { - if (error) { + api.onBuildComplete(({ err }) => { + if (err) { return; } api.logger.info('💄 build theme');