Repository navigation
Description
Command
build
Description
With a build configuration such as:
{
"browser": "src/main.ts",
"styles": ["src/styles.css"]
}I would like to be able to map browser -> main-[hash].js and styles -> styles-[hash].css reliably after a build.
We are using Angular for micro-frontends. When these micro-frontends are deployed, we need to allow the shell application to discover the correct files for each app entry point. There is a service that tracks these mappings in a manifest, and the shell requests this manifest on startup. During deployment, we need to tell this service what the entry point files are.
Today, our only options to do this are to use filename heuristics or build with source maps and parse those to look for the sources field.
Describe the solution you'd like
The @angular/build:application builder should provide an option to output a file which can map these source file entrypoints to a corresponding output file.
Basic Example
{
"browser": "src/main.ts",
"styles": ["src/styles.css"],
"manifest": true
}Would generate in dist/app/browser/manifest.json
{
"browser": "main-[hash].js",
"styles": "styles-[hash].css"
}Multiple Style Bundles
If you have multiple style bundles, it would split those in the manifest. This is important because fonts have to be loaded at the root of the document, but shadow-dom components used for custom elements need a separate bundle to load into their shadow root.
{
"browser": "src/main.ts",
"styles": [
{
"bundleName": "styles",
"input": "src/styles.css"
},
{
"bundleName": "fonts",
"input": "src/fonts.scss"
}
]
}Manifest:
{
"browser": "main-[hash].js",
"styles": {
"styles": "styles-[hash].css",
"fonts": "fonts-[hash].css"
}
}Describe alternatives you've considered
- Use file name heuristics to guess which bundle files map to input sources. For example, look for a file name matching a regex like
^main-[^-].js$for the main entry point, or^styles-[^-].css$for styles.
- Angular may change the output file naming scheme, and the heuristic will no longer work.
- There may be lazy chunks that happen to end up with a file name that matches the entry point pattern.
- Parse
index.htmlfor entry point files. - Parse source maps and look for an entry in
sourcesmatching the entry point filename.
- After optimization, certain entry files can be omitted from the sources array. For example, if two stylesheets have the same content, only one will be in the sources array.
// angular.json options
{
// assume these two files have the same content
"styles": ["styles-1.css", "styles-2.css"]
}The build merges them and deduplicates the style, generating a sourcemap with sources like this:
{
"sources": ["styles-2.css"]
}
Activity
alan-agius4 commentedon Sep 7, 2026
Hi @eblocha,
Thank you for opening this feature request.
Generating custom manifest files for micro-frontend discovery is outside the scope of
@angular/build:application. There is no single standardized format for micro-frontend manifests; different architectures, deployment services, and orchestrators (such as Module Federation, Native Federation, import maps, or custom shell loaders) expect different metadata structures, entry point mappings, and asset formats. Supporting and maintaining specific manifest schemas directly within the application builder would add unnecessary coupling and maintenance overhead.That said, you can already achieve this reliably today without relying on filename heuristics or parsing source maps by enabling the
statsJsonoption (--stats-jsonor"statsJson": trueinangular.json).When enabled, the builder generates
browser-stats.jsonin your build output directory, which contains the standard esbuild metafile. The metafile provides a reliable mapping of all outputs and their corresponding source entry points via theoutputsproperty:{ "outputs": { "browser/main-A1B2C3D4.js": { "entryPoint": "src/main.ts", "inputs": { ... }, "bytes": 123456 }, "browser/styles-E5F6G7H8.css": { "entryPoint": "src/styles.css", "inputs": { ... }, "bytes": 45678 } } }You can extract the exact mappings you need and generate your custom
manifest.jsonvia a lightweight post-build script (e.g., run as part of apostbuildnpm script or CI step):Because the required data is already exposed through standard build stats and the manifest schema is specific to your deployment setup, we won't be adding a built-in manifest generator option to the builder.
angular-automatic-lock-bot commentedon Oct 21, 2026
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.