Skip to content

Commit

Permalink
🐛 bug: fix absOutputPath and onBuildComplete bug
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Mar 12, 2020
1 parent aa67fc9 commit 2dbaf8a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));

// 增加中间件
Expand All @@ -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');
Expand Down

0 comments on commit 2dbaf8a

Please sign in to comment.