Skip to content

Commit

Permalink
Merge pull request #675 from carvinlo/develop-fix-multi-build
Browse files Browse the repository at this point in the history
fix: stop bundler before restart the process
  • Loading branch information
FlorianRappl committed Feb 9, 2024
2 parents 30bfbfd + 00d9c19 commit 973dddf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/tooling/piral-cli/src/apps/debug-pilet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,6 @@ export async function debugPilet(baseDir = process.cwd(), options: DebugPiletOpt

await hooks.beforeBuild?.({ root, publicUrl, importmap, entryModule, schemaVersion });

watcherContext.watch(join(root, packageJson));
watcherContext.watch(join(root, piletJson));

const bundler = await callPiletDebug(
{
root,
Expand All @@ -298,6 +295,10 @@ export async function debugPilet(baseDir = process.cwd(), options: DebugPiletOpt
bundlerName,
);

watcherContext.watch(join(root, packageJson));
watcherContext.watch(join(root, piletJson));
watcherContext.onClean(() => bundler.stop());

bundler.on((args) => {
hooks.afterBuild?.({
...args,
Expand Down Expand Up @@ -342,7 +343,7 @@ export async function debugPilet(baseDir = process.cwd(), options: DebugPiletOpt
await Promise.all(
appInstances.sort(byPort).map(async ([appDir, appPort], i) => {
const platform = configurePlatform();

if (networks.length === i) {
networks.push({
port: appPort || originalPort + i,
Expand Down

0 comments on commit 973dddf

Please sign in to comment.