Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(angular): port should be added to serve-ssr for remote #13399

Merged
merged 1 commit into from Nov 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions packages/angular/src/generators/remote/lib/add-ssr.ts
Expand Up @@ -6,7 +6,6 @@ import {
readProjectConfiguration,
updateProjectConfiguration,
} from '@nrwl/devkit';
import type { Schema } from '../schema';

import setupSsr from '../../setup-ssr/setup-ssr';
import {
Expand All @@ -15,7 +14,10 @@ import {
moduleFederationNodeVersion,
} from '../../../utils/versions';

export async function addSsr(tree: Tree, options: Schema, appName: string) {
export async function addSsr(
tree: Tree,
{ appName, port }: { appName: string; port: number }
) {
let project = readProjectConfiguration(tree, appName);

await setupSsr(tree, {
Expand Down Expand Up @@ -44,6 +46,10 @@ export async function addSsr(tree: Tree, options: Schema, appName: string) {
project.targets.server.options.customWebpackConfig = {
path: joinPathFragments(project.root, 'webpack.server.config.js'),
};
project.targets['serve-ssr'].options = {
...(project.targets['serve-ssr'].options ?? {}),
port,
};

updateProjectConfiguration(tree, appName, project);

Expand Down
2 changes: 1 addition & 1 deletion packages/angular/src/generators/remote/remote.ts
Expand Up @@ -43,7 +43,7 @@ export async function remote(tree: Tree, options: Schema) {

let installTasks = [appInstallTask];
if (options.ssr) {
let ssrInstallTask = await addSsr(tree, options, appName);
let ssrInstallTask = await addSsr(tree, { appName, port });
installTasks.push(ssrInstallTask);
}

Expand Down