Skip to content

Commit

Permalink
fix(angular): use the correct output path for mf ssr #18849
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Aug 30, 2023
1 parent 83f2001 commit 10bc223
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import { AppServerModule } from './bootstrap.server';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express();
const browserBundles = join(process.cwd(), 'dist/apps/test/browser');
const browserBundles = join(process.cwd(), 'dist/test/browser');
server.use(cors());
const indexHtml = existsSync(join(browserBundles, 'index.original.html'))
Expand Down Expand Up @@ -223,7 +223,7 @@ import bootstrap from './bootstrap.server';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express();
const browserBundles = join(process.cwd(), 'dist/apps/test/browser');
const browserBundles = join(process.cwd(), 'dist/test/browser');
server.use(cors());
const indexHtml = existsSync(join(browserBundles, 'index.original.html'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import<% if(standalone) { %> bootstrap <% } else { %> { AppServerModule } <% } %
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express();
const browserBundles = join(process.cwd(), 'dist/apps/<%= appName %>/browser');
const browserBundles = join(process.cwd(), '<%= browserBundleOutput %>');

server.use(cors());
const indexHtml = existsSync(join(browserBundles, 'index.original.html'))
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/src/generators/host/host.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { stripIndents, updateJson } from '@nx/devkit';
import { stripIndents, updateJson, updateNxJson } from '@nx/devkit';
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
import {
getProjects,
Expand Down
6 changes: 6 additions & 0 deletions packages/angular/src/generators/host/lib/add-ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,14 @@ export async function addSsr(tree: Tree, options: Schema, appName: string) {
"import('./src/main.server');"
);

const browserBundleOutput = joinPathFragments(
project.targets.build.options.outputPath,
'browser'
);

generateFiles(tree, join(__dirname, '../files'), project.root, {
appName,
browserBundleOutput,
standalone: options.standalone,
tmpl: '',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ import { AppServerModule } from './bootstrap.server';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express();
const browserBundles = join(process.cwd(), 'dist/apps/test/browser');
const serverBundles = join(process.cwd(), 'dist/apps/test/server');
const browserBundles = join(process.cwd(), 'dist/test/browser');
const serverBundles = join(process.cwd(), 'dist/test/server');
server.use(cors());
const indexHtml = existsSync(join(browserBundles, 'index.original.html'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import<% if(standalone) { %> bootstrap <% } else { %> { AppServerModule } <% } %
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express();
const browserBundles = join(process.cwd(), 'dist/apps/<%= appName %>/browser');
const serverBundles = join(process.cwd(), 'dist/apps/<%= appName %>/server');
const browserBundles = join(process.cwd(), '<%= browserBundleOutput %>');
const serverBundles = join(process.cwd(), '<%= serverBundleOutput %>');

server.use(cors());
const indexHtml = existsSync(join(browserBundles, 'index.original.html'))
Expand Down
11 changes: 11 additions & 0 deletions packages/angular/src/generators/remote/lib/add-ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,23 @@ export async function addSsr(
"import('./src/main.server');"
);

const browserBundleOutput = joinPathFragments(
project.targets.build.options.outputPath,
'browser'
);
const serverBundleOutput = joinPathFragments(
project.targets.build.options.outputPath,
'server'
);

generateFiles(
tree,
joinPathFragments(__dirname, '../files/base'),
project.root,
{
appName,
browserBundleOutput,
serverBundleOutput,
standalone,
tmpl: '',
}
Expand Down

0 comments on commit 10bc223

Please sign in to comment.