Skip to content

Commit

Permalink
fix(angular): generate app server module setup correctly in setup-ssr…
Browse files Browse the repository at this point in the history
… generator (#21702)

(cherry picked from commit ab9c579)
  • Loading branch information
leosvelperez authored and FrozenPandaz committed Feb 9, 2024
1 parent 8464b64 commit 3623505
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ platformBrowserDynamic()
`;
exports[`Host App Generator --ssr should generate the correct files 3`] = `
"export { AppServerModule } from './app/app.server.module';
"export { AppServerModule as default } from './app/app.server.module';
"
`;
Expand Down Expand Up @@ -722,7 +722,7 @@ platformBrowserDynamic()
`;
exports[`Host App Generator --ssr should generate the correct files when --typescript=true 3`] = `
"export { AppServerModule } from './app/app.server.module';
"export { AppServerModule as default } from './app/app.server.module';
"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ platformBrowserDynamic()
`;
exports[`MF Remote App Generator --ssr should generate the correct files 3`] = `
"export { AppServerModule } from './app/app.server.module';
"export { AppServerModule as default } from './app/app.server.module';
"
`;
Expand Down Expand Up @@ -339,7 +339,7 @@ platformBrowserDynamic()
`;
exports[`MF Remote App Generator --ssr should generate the correct files when --typescriptConfiguration=true 3`] = `
"export { AppServerModule } from './app/app.server.module';
"export { AppServerModule as default } from './app/app.server.module';
"
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ngExpressEngine } from '@nguniversal/express-engine';
import * as express from 'express';
import { existsSync } from 'fs';
import { join } from 'path';
import { AppServerModule } from './src/main.server';
import AppServerModule from './src/main.server';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
Expand Down Expand Up @@ -123,7 +123,7 @@ import { CommonEngine } from '@angular/ssr';
import express from 'express';
import { fileURLToPath } from 'node:url';
import { dirname, join, resolve } from 'node:path';
import { AppServerModule } from './src/main.server';
import AppServerModule from './src/main.server';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
Expand Down Expand Up @@ -332,7 +332,7 @@ import { CommonEngine } from '@angular/ssr';
import * as express from 'express';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import { AppServerModule } from './src/main.server';
import AppServerModule from './src/main.server';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { <%= rootModuleClassName %> } from './app/<%= rootModuleFileName.slice(0, -3) %>';
export { <%= rootModuleClassName %> as default } from './app/<%= rootModuleFileName.slice(0, -3) %>';
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CommonEngine } from '@angular/ssr';
import express from 'express';
import { fileURLToPath } from 'node:url';
import { dirname, join, resolve } from 'node:path';
import <% if (standalone) { %>bootstrap<% } else { %>{ <%= rootModuleClassName %> }<% } %> from './src/<%= main.slice(0, -3) %>';
import <% if (standalone) { %>bootstrap<% } else { %><%= rootModuleClassName %><% } %> from './src/<%= main.slice(0, -3) %>';

// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ngExpressEngine } from '@nguniversal/express-engine';
import * as express from 'express';
import { existsSync } from 'fs';
import { join } from 'path';
import <% if (standalone) { %>bootstrap<% } else { %>{ <%= rootModuleClassName %> }<% } %> from './src/<%= main.slice(0, -3) %>';
import <% if (standalone) { %>bootstrap<% } else { %><%= rootModuleClassName %><% } %> from './src/<%= main.slice(0, -3) %>';

// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { CommonEngine } from '@angular/ssr';
import * as express from 'express';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import <% if (standalone) { %>bootstrap<% } else { %>{ <%= rootModuleClassName %> }<% } %> from './src/<%= main.slice(0, -3) %>';
import <% if (standalone) { %>bootstrap<% } else { %><%= rootModuleClassName %><% } %> from './src/<%= main.slice(0, -3) %>';

// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
Expand Down
4 changes: 2 additions & 2 deletions packages/angular/src/generators/setup-ssr/setup-ssr.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('setupSSR', () => {
expect(tree.read('app1/server.ts', 'utf-8')).toMatchSnapshot();
expect(tree.read('app1/src/main.server.ts', 'utf-8'))
.toMatchInlineSnapshot(`
"export { AppServerModule } from './app/app.server.module';
"export { AppServerModule as default } from './app/app.server.module';
"
`);
expect(tree.read('app1/src/main.ts', 'utf-8')).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -204,7 +204,7 @@ describe('setupSSR', () => {
expect(tree.read('app1/server.ts', 'utf-8')).toMatchSnapshot();
expect(tree.read('app1/src/main.server.ts', 'utf-8'))
.toMatchInlineSnapshot(`
"export { AppServerModule } from './app/app.server.module';
"export { AppServerModule as default } from './app/app.server.module';
"
`);
expect(tree.read('app1/src/main.ts', 'utf-8')).toMatchInlineSnapshot(`
Expand Down

0 comments on commit 3623505

Please sign in to comment.