fix(angular): use the correct output path for mf ssr #18849 (#18906)

This commit is contained in:
Colum Ferry 2023-08-30 12:53:46 +01:00 committed by GitHub
parent 83f2001230
commit 5a0634323e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 7 deletions

View File

@ -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'))
@ -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'))

View File

@ -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'))

View File

@ -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: '',
});

View File

@ -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'))

View File

@ -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'))

View File

@ -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: '',
}