-
Notifications
You must be signed in to change notification settings - Fork 12k
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
feat(@angular/build): introduce outputMode
option to the application builder
#28355
Conversation
f90791f
to
7d2f132
Compare
28a16ca
to
a3f50d5
Compare
a3f50d5
to
ac71ce1
Compare
859f6b9
to
3814f19
Compare
5c30f3d
to
23c32aa
Compare
8e1a54c
to
d33ec81
Compare
655b76a
to
3974957
Compare
if (options.prerender) { | ||
context.logger.warn( | ||
'The "prerender" option is no longer needed when "outputMode" is specified.', | ||
); | ||
} else { | ||
options.prerender = !!options.server; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like when prerender is false here, it will be ignored. Is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, both prerender and appshell options are unused with the new API. As prerendering and app-shell is controlled through the routes config.
3974957
to
f01d2da
Compare
packages/angular/build/src/builders/application/execute-build.ts
Outdated
Show resolved
Hide resolved
…n builder The `outputMode` option accepts two values: - **`static`:** Generates a static output (HTML, CSS, JavaScript) suitable for deployment on static hosting services or CDNs. This mode supports both client-side rendering (CSR) and static site generation (SSG). - **`server`:** Generates a server bundle in addition to static assets, enabling server-side rendering (SSR) and hybrid rendering strategies. This output is intended for deployment on a Node.js server or serverless environment. - **Replaces `appShell` and `prerender`:** The `outputMode` option simplifies the CLI by replacing the `appShell` and `prerender` options when server-side routing is configured. - **Controls Server API Usage:** `outputMode` determines whether the new server API is utilized. In `server` mode, `server.ts` is bundled as a separate entry point, preventing direct references to `main.server.ts` and excluding it from localization. Closes angular#27356, closes angular#27403, closes angular#25726, closes angular#25718 and closes angular#27196
f01d2da
to
5de4d93
Compare
Are there any example on how to use this? |
@alan-agius4 So glad this is finally solved, thank you! When will it be released? And could you please provide an example how to setup an ssr app with i18n enabled, so we can get rid of the workaround mentioned here: #25726 |
@patricsteiner, this is part of Angular version 19 which is currently in pre-release. The schematics will be updated to use the new API. In the meantime you can check this test for an example. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The
outputMode
option defines the build output target, offering two modes:'static'
: Generates a static site suitable for deployment on any static hosting service. This mode can produce a fully client-side rendered (CSR) or static site generated (SSG) site. When SSG is enabled, redirects are handled using the<meta>
tag.'server'
: Produces an application designed for deployment on a server that supports server-side rendering (SSR) or a hybrid approach.Additionally, the
outputMode
option determines whether the new API is used. If enabled, it bundles theserver.ts
as a separate entry point, preventing it from directly referencingmain.server.ts
and excluding it from localization.This option will replace
appShell
andprerendering
when server routing configuration is present.closes #27356
closes #27403
closes #25726
closes #25718
closes #27196