Skip to content

Commit

Permalink
fix(angular): use the correct output path for mf ssr nrwl#18849
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Aug 30, 2023
1 parent 83f2001 commit 731a4bf
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 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
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 731a4bf

Please sign in to comment.