Overview
Introduction
angular.json controls output paths, bundle-size budgets, environment-file swapping, and dev-server proxying for every Angular CLI project, but its deeply nested `architect.build`/`architect.serve` shape means a lot of scrolling through Angular's own reference docs to assemble even a small change.
This tool generates a ready-to-merge angular.json project snippet covering exactly those four concerns from a simple form.
What Is Angular.json Build Target Generator?
An angular.json build-target snippet generator covering outputPath, initial and anyComponentStyle budgets (with warning/error thresholds), a fileReplacements entry for the production environment file, and a serve target with a dev-server port and proxyConfig path.
The output is a JSON object keyed by your project name, structured exactly as angular.json's `projects.<name>.architect` block expects, ready to merge into an existing angular.json.
How Angular.json Build Target Generator Works
Your budget thresholds are placed into two budget objects (type: "initial" and type: "anyComponentStyle"), each with maximumWarning/maximumError sizes exactly as the Angular CLI's schema requires.
The fileReplacements array is built from the standard environment.ts → environment.prod.ts (or your custom production file name) swap, and the serve target's port/proxyConfig are included only when you've provided them.
When To Use Angular.json Build Target Generator
Use it when setting stricter bundle-size budgets on an existing Angular project, or when setting up a new project's build target and want the standard environment file-replacement wiring without re-deriving the JSON shape.
It's also useful for adding a dev-server proxy to an Angular project that's calling a local backend API for the first time.
Often used alongside Next.js Config Generator and React Environment Variables Generator.
Features
Advantages
- Produces the exact nested JSON shape angular.json's schema expects for budgets, fileReplacements, and serve options, avoiding a misplaced key deep in the structure.
- Only includes serve-target options (port, proxyConfig) you actually provided, so merging doesn't overwrite unrelated existing serve settings with empty values.
- Covers both initial-bundle and per-component-style budgets together, since both matter for catching bloat early but are easy to only remember one of.
Limitations
- Outputs a snippet meant to be merged into an existing angular.json by hand, since angular.json also contains many other unrelated project settings this tool doesn't (and shouldn't) manage.
- Covers the build/serve options listed above only; other architect targets (test, lint, e2e) aren't included and would need separate configuration.
Examples
Best Practices & Notes
Best Practices
- Set budget error thresholds tight enough to actually fail CI on a real regression, a budget that never triggers provides no protection against bundle bloat creeping in over time.
- Keep proxy.conf.json (referenced by proxyConfig) checked into the repo so every contributor's local dev server proxies to the backend the same way.
- Revisit budgets periodically as the app grows; a budget set once at project start and never revisited either blocks legitimate growth or stops protecting against real bloat.
Developer Notes
Angular's budget system (`architect.build.options.budgets`) is evaluated by the Angular CLI's build-optimizer against the actual compiled/bundled output size per budget type, with "initial" checked against the combined main/polyfills/runtime chunks needed before the app becomes interactive, and "anyComponentStyle" checked per individual component stylesheet rather than a project-wide total. fileReplacements operates at the TypeScript compilation level, literally swapping which file a given import path resolves to for a specific build configuration (commonly "production"), rather than doing any runtime environment-variable substitution.
Angular.json Build Target Generator Use Cases
- Adding bundle-size budgets to an Angular project's build target for the first time
- Setting up a local dev-server proxy so ng serve forwards API calls to a local backend
- Configuring the production environment file swap for a project missing fileReplacements
Common Mistakes
- Setting budget error thresholds so loose they never actually fail a build, providing no real protection against bundle-size regressions.
- Forgetting that fileReplacements only applies to whichever build configuration references it (commonly "production"), so a default `ng build` without that configuration still uses the unswapped environment.ts.
Tips
- Use the React Environment Variables Generator's approach as a mental model if you're also configuring environment-specific values for a companion Node/React service alongside this Angular app.