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): generate app server module setup correctly in setup-ssr generator #21702

Merged
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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