Skip to content

Commit

Permalink
fix #12777 failed to start unocss with mako (#12778)
Browse files Browse the repository at this point in the history
* chore: test unocss with mako

* fix: #12777 unocss 开发模式下,等待unocss进程启动
  • Loading branch information
AdoKevin authored Nov 14, 2024
1 parent b5ed8e4 commit c4bf5c0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/with-unocss/.umirc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default {
mako: {},
plugins: [require.resolve('@umijs/plugins/dist/unocss')],
unocss: {
watch: ['pages/**/*.tsx'],
Expand Down
14 changes: 13 additions & 1 deletion packages/plugins/src/unocss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,19 @@ export default (api: IApi) => {
cwd: api.cwd,
stdio: isDev ? 'pipe' : 'inherit',
});
if (!isDev) {

if (isDev) {
await new Promise<void>((resolve) => {
const { stdout } = execaRes;
function dataHandler() {
resolve();
stdout?.off('data', dataHandler);
}
stdout?.on('data', dataHandler);
});

api.logger.info('unocss watch mode is running!');
} else {
await execaRes;
}
});
Expand Down

0 comments on commit c4bf5c0

Please sign in to comment.