From 60c62bd771c2b29523f9fa267ada337aaf0e9a8c Mon Sep 17 00:00:00 2001 From: SkyZeroZx <73321943+SkyZeroZx@users.noreply.github.com> Date: Thu, 16 Oct 2025 17:07:26 -0500 Subject: [PATCH] docs: Documents sourcesContent option for source maps (#64482) PR Close #64482 --- .../reference/configs/workspace-config.md | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/adev/src/content/reference/configs/workspace-config.md b/adev/src/content/reference/configs/workspace-config.md index e949b5fefaf..f892c8bd746 100644 --- a/adev/src/content/reference/configs/workspace-config.md +++ b/adev/src/content/reference/configs/workspace-config.md @@ -448,12 +448,13 @@ You can supply a value such as the following to apply optimization to one or the The `sourceMap` builder option can be either a boolean or an object for more fine-tune configuration to control the source maps of an application. -| Options | Details | Value type | Default value | -| :-------- | :-------------------------------------------------- | :--------- | :------------ | -| `scripts` | Output source maps for all scripts. | `boolean` | `true` | -| `styles` | Output source maps for all styles. | `boolean` | `true` | -| `vendor` | Resolve vendor packages source maps. | `boolean` | `false` | -| `hidden` | Omit link to sourcemaps from the output JavaScript. | `boolean` | `false` | +| Options | Details | Value type | Default value | +| :--------------- | :----------------------------------------------------------- | :--------- | :------------ | +| `scripts` | Output source maps for all scripts. | `boolean` | `true` | +| `styles` | Output source maps for all styles. | `boolean` | `true` | +| `vendor` | Resolve vendor packages source maps. | `boolean` | `false` | +| `hidden` | Omit link to sourcemaps from the output JavaScript. | `boolean` | `false` | +| `sourcesContent` | Output original source content for files within source maps. | `boolean` | `true` | The example below shows how to toggle one or more values to configure the source map outputs: @@ -483,6 +484,34 @@ HELPFUL: When using hidden source maps, source maps are not referenced in the bu These are useful if you only want source maps to map stack traces in error reporting tools without showing up in browser developer tools. Note that even though `hidden` prevents the source map from being linked in the output bundle, your deployment process must take care not to serve the generated sourcemaps in production, or else the information is still leaked. +#### Source maps without sources content + +You can generate source maps without the `sourcesContent` field, which contains the original source code. +This allows you to deploy source maps to production for better error reporting with original source names while protecting your source code from exposure. + +To exclude sources content from source maps, set the `sourcesContent` option to `false`: + +```json +{ + "projects": { + "my-app": { + "architect": { + "build": { + "builder": "@angular/build:application", + "options": { + "sourceMap": { + "scripts": true, + "styles": true, + "sourcesContent": false + } + } + } + } + } + } +} +``` + ### Index configuration Configures generation of the application's HTML index.