angular/adev
Alan Agius 9d1fb33f5e fix(core): introduce BootstrapContext for improved server bootstrapping (#63640)
This commit introduces a number of changes to the server bootstrapping process to make it more robust and less error-prone, especially for concurrent requests.

Previously, the server rendering process relied on a module-level global platform injector. This could lead to issues in server-side rendering environments where multiple requests are processed concurrently, as they could inadvertently share or overwrite the global injector state.

The new approach introduces a `BootstrapContext` that is passed to the `bootstrapApplication` function. This context provides a platform reference that is scoped to the individual request, ensuring that each server-side render has an isolated platform injector. This prevents state leakage between concurrent requests and makes the overall process more reliable.

BREAKING CHANGE:
The server-side bootstrapping process has been changed to eliminate the reliance on a global platform injector.

Before:
```ts
const bootstrap = () => bootstrapApplication(AppComponent, config);
```

After:
```ts
const bootstrap = (context: BootstrapContext) =>
  bootstrapApplication(AppComponent, config, context);
```

A schematic is provided to automatically update `main.server.ts` files to pass the `BootstrapContext` to the `bootstrapApplication` call.

In addition, `getPlatform()` and `destroyPlatform()` will now return `null` and be a no-op respectively when running in a server environment.

(cherry picked from commit 8bf80c9d2314b4f2bcf3df83ae01552a6fc49834)

PR Close #63640
2025-09-09 10:46:27 -07:00
..
scripts/update-cli-help refactor(docs-infra): complete removal of aio directory (#56496) 2024-06-18 12:26:00 -07:00
shared-docs docs: angular dev v18 page issue fix (#58848) 2024-11-26 14:48:54 +00:00
src fix(core): introduce BootstrapContext for improved server bootstrapping (#63640) 2025-09-09 10:46:27 -07:00
tools refactor(docs-infra): migrate api-gen from dev-infra into the repo (#57241) 2024-08-05 17:06:29 +00:00
angular.json test(docs-infra): update adev tests to be zoneless (#57100) 2024-07-23 14:50:32 -07:00
BUILD.bazel build(docs-infra): use chunk optimizer for adev builds (#56830) 2024-09-19 12:44:51 +02:00
firebase.json docs: fix missing image and baseUrl in tutorials/first-app (#56766) 2024-07-02 20:21:40 +00:00
karma.conf.js refactor(docs-infra): move windows-chromium-path to adev (#56496) 2024-06-18 12:25:59 -07:00
README.md docs(router): update initial navigation SSR note (#57245) 2024-08-07 16:45:30 +00:00
test-main.ts test(docs-infra): update adev tests to be zoneless (#57100) 2024-07-23 14:50:32 -07:00
tsconfig.app.json docs(docs-infra): Go zoneless and enable the zoneless scheduler (#55161) 2024-06-07 09:31:15 -07:00
tsconfig.json refactor(docs-infra): migrate api-gen from dev-infra into the repo (#57241) 2024-08-05 17:06:29 +00:00
tsconfig.spec.json test(docs-infra): update adev tests to be zoneless (#57100) 2024-07-23 14:50:32 -07:00
tsconfig.worker.json refactor(docs-infra): refactor adev to build using architect (#53497) 2023-12-11 19:21:07 +00:00
tslint.json docs: add angular.dev (#52536) 2023-11-06 11:15:02 -08:00

Angular.dev

This site is built with Angular.

The content is written primarily in Markdown format located in src/content. For simple edits, you can directly edit the file on GitHub and generate a Pull Request.

Local Development

For local development, yarn is the preferred package manager. You can setup a local environment with the following commands :

# Clone Angular repo
git clone https://github.com/angular/angular.git

# Navigate to project directory
cd angular

# Install dependencies
yarn

# Build and run local dev server
# Note: Initial build will take some time
yarn docs

If you are having issues with the docs building, see the FAQs section.

Contributing

Want to report a bug, contribute some code, or improve the documentation? Excellent!

Read through our contributing guidelines to learn about our submission process, coding rules, and more.

And if you're new, check out one of our issues labeled as help wanted or good first issue.

Code of Conduct

Help us keep Angular open and inclusive. Please read and follow our Code of Conduct.

FAQs

The build is failing and I'm seeing bazel:bazel failed: missing input file messages.

This is most likely due to a bazel dependency / caching issue. To resolve this, run the following command:

# Try this first
yarn bazel clean

# If that doesn't work, try it with the expunge flag
yarn bazel clean --expunge