Skip to content

Commit

Permalink
fix(angular): port should be added to serve-ssr for remote
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Nov 25, 2022
1 parent 3fe5df7 commit aefcd0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
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

0 comments on commit aefcd0f

Please sign in to comment.