fix(react): ssr should serve correctly and e2e should function (#17725)

This commit is contained in:
Colum Ferry 2023-06-22 14:51:41 +01:00 committed by GitHub
parent 1fcba1a43a
commit fffd84c3aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 153 additions and 152 deletions

View File

@ -9,8 +9,8 @@ import {
} from '@nx/devkit';
import { daemonClient } from 'nx/src/daemon/client/client';
import { randomUUID } from 'crypto';
import { join } from 'path';
import * as path from 'path';
import { join } from 'path';
import { InspectType, NodeExecutorOptions } from './schema';
import { createAsyncIterable } from '@nx/devkit/src/utils/async-iterable';
@ -81,8 +81,10 @@ export async function* nodeExecutor(
const tasks: ActiveTask[] = [];
let currentTask: ActiveTask = null;
yield* createAsyncIterable<{ success: boolean }>(
async ({ done, next, error }) => {
yield* createAsyncIterable<{
success: boolean;
options?: Record<string, any>;
}>(async ({ done, next, error }) => {
const processQueue = async () => {
if (tasks.length === 0) return;
@ -110,9 +112,7 @@ export async function* nodeExecutor(
task.promise = new Promise<void>(async (resolve, reject) => {
task.childProcess = exec(
`npx nx run ${context.projectName}:${buildTarget.target}${
buildTarget.configuration
? `:${buildTarget.configuration}`
: ''
buildTarget.configuration ? `:${buildTarget.configuration}` : ''
}`,
{
cwd: context.root,
@ -185,7 +185,7 @@ export async function* nodeExecutor(
resolve();
});
next({ success: true });
next({ success: true, options: buildOptions });
});
},
stop: async (signal = 'SIGTERM') => {
@ -246,8 +246,7 @@ export async function* nodeExecutor(
await addToQueue();
await processQueue();
}
);
});
}
function getExecArgv(options: NodeExecutorOptions) {
@ -284,6 +283,7 @@ function calculateResolveMappings(
return m;
}, {});
}
function runWaitUntilTargets(
options: NodeExecutorOptions,
context: ExecutorContext

View File

@ -115,6 +115,7 @@ export async function setupSsrGenerator(tree: Tree, options: Schema) {
target: 'node',
main: `${projectRoot}/server.ts`,
outputPath: joinPathFragments(originalOutputPath, 'server'),
outputFileName: 'server.js',
tsConfig: `${projectRoot}/tsconfig.server.json`,
compiler: 'babel',
externalDependencies: 'all',