Skip to content

Commit

Permalink
fix: dist lost if multi-entry umd used in dev command (#590)
Browse files Browse the repository at this point in the history
* fix: dist lost if multi-entry umd used in dev command

* style: put empty line
  • Loading branch information
PeachScript authored Feb 28, 2023
1 parent 4586693 commit 49cd3a0
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/builder/bundle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ async function bundless(opts: IBundlessOpts): Promise<void | IBundleWatcher> {
{ leading: true, trailing: false },
);

// log for normal build
!opts.watch && logStatus();
await bundler.build({
cwd: opts.cwd,
watch: opts.watch,
Expand Down Expand Up @@ -142,23 +144,25 @@ async function bundless(opts: IBundlessOpts): Promise<void | IBundleWatcher> {
? {
onBuildComplete({ isFirstCompile, close }: any) {
if (isFirstCompile) closeHandlers.push(close);
// log for watch mode
else logStatus();
},
}
: {}),
});
}

// return watching closer for watch mode
if (opts.watch)
return {
close() {
return Promise.all(
closeHandlers.map(
(handler) => new Promise((resolve) => handler(resolve)),
),
);
},
};
// return watching closer for watch mode
if (opts.watch) {
return {
close() {
return Promise.all(
closeHandlers.map(
(handler) => new Promise((resolve) => handler(resolve)),
),
);
},
};
}
}

Expand Down

0 comments on commit 49cd3a0

Please sign in to comment.