Skip to content

Commit

Permalink
fix(react): use fork for module-federation-dev-server so processes ar…
Browse files Browse the repository at this point in the history
…e cleaned up correctly (#17194)
  • Loading branch information
jaysoo committed May 25, 2023
1 parent 18720ec commit 7cc67a3
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {
} from '@nx/devkit/src/utils/async-iterable';
import * as chalk from 'chalk';
import { waitForPortOpen } from '@nx/web/src/utils/wait-for-port-open';
import { spawn } from 'child_process';
import { findMatchingProjects } from 'nx/src/utils/find-matching-projects';
import { fork } from 'child_process';

type ModuleFederationDevServerOptions = WebDevServerOptions & {
devRemotes?: string | string[];
Expand Down Expand Up @@ -83,15 +83,17 @@ export default async function* moduleFederationDevServer(
);
} else {
let outWithErr: null | string[] = [];
const staticProcess = spawn(
`node ${nxBin} run ${appName}:serve-static${
context.configurationName ? `:${context.configurationName}` : ''
}`,
const staticProcess = fork(
nxBin,
[
'run',
`${appName}:serve-static${
context.configurationName ? `:${context.configurationName}` : ''
}`,
],
{
cwd: context.root,
stdio: ['ignore', 'pipe', 'pipe'],
shell: true,
windowsHide: true,
stdio: ['ignore', 'pipe', 'pipe', 'ipc'],
}
);
staticProcess.stdout.on('data', (data) => {
Expand Down

1 comment on commit 7cc67a3

@vercel
Copy link

@vercel vercel bot commented on 7cc67a3 May 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-five.vercel.app
nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx.dev

Please sign in to comment.