# angular-extended-builder

> Angular extended builders with custom options for esbuild and Vite

Latest version **22.0.1** (published 2026-11-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install angular-extended-builder
pnpm add angular-extended-builder
yarn add angular-extended-builder
bun add angular-extended-builder
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 22.0.1 |
| Published | 2026-11-19 |
| First published | 2024-10-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=24 |
| Dependencies | 2 |
| Unpacked size | 346.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1 |
| Maintainers | muuvmuuv |
| Keywords | angular, angular-builder, builder, esbuild, vite |

## Links

- npm: https://www.npmjs.com/package/angular-extended-builder
- Repository: https://github.com/muuvmuuv/angular-extended-builders
- Homepage: https://github.com/muuvmuuv/angular-extended-builders#readme
- Issues: https://github.com/muuvmuuv/angular-extended-builders/issues
- npm.io page: https://npm.io/package/angular-extended-builder

## Dependencies (2)

- [tsx](https://npm.io/package/tsx.md) ^4.23.15
- [tslib](https://npm.io/package/tslib.md) ^2.9.1

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 22.0.1 (latest) — 2026-11-19
- 22.0.0 — 2026-06-26
- 21.2.0 — 2026-04-14
- 21.0.2 — 2025-12-02
- 21.0.1 — 2025-12-02
- 21.0.0 — 2025-12-02
- 20.3.13 — 2025-10-31
- 20.3.11 — 2025-10-31
- 20.3.10 — 2025-10-30
- 20.3.9 — 2025-10-30
- 20.3.8 — 2025-10-30
- 20.3.0 — 2025-09-13
- 20.2.1 — 2025-09-01
- 20.1.5 — 2025-08-13
- 20.1.4 — 2025-08-13
- … 23 more at https://npm.io/package/angular-extended-builder/versions

## README

# Angular Extended Builder

> Forked/inspired by [angular-builders](https://github.com/just-jeb/angular-builders)

Custom Angular builders that extend `@angular/build` with support for esbuild plugins, index HTML transformers, and Vite dev-server middlewares.

- [Installation](#installation)
- [Builders](#builders)
- [How to](#how-to)
  - [Esbuild Plugins](#esbuild-plugins)
  - [Index HTML Transformer](#index-html-transformer)
  - [Dev Server Middlewares](#dev-server-middlewares)
- [Version Compatibility](#version-compatibility)

## Installation

```bash
npm install angular-extended-builder --save-dev
# or
pnpm add -D angular-extended-builder
```

## Setup

1. Update your `angular.json` to use the extended builders:

```jsonc
{
	"$schema": "./node_modules/angular-extended-builder/dist/schema.json",
	"projects": {
		"my-app": {
			"architect": {
				"build": {
					"builder": "angular-extended-builder:application",
					"options": {
						"plugins": ["./plugins/my-esbuild-plugin.ts"],
						"indexHtmlTransformer": "./plugins/index-html-transform.mjs",
						// ... your existing build options
					},
				},
				"serve": {
					"builder": "angular-extended-builder:dev-server",
					"options": {
						"middlewares": ["./plugins/my-middleware.ts"],
					},
				},
			},
		},
	},
}
```

2. The `$schema` path enables IDE autocomplete and validation for the extended options.

## Builders

| Name        | Extended Options                                 |
| ----------- | ------------------------------------------------ |
| application | [schema.json](./src/lib/application/schema.json) |
| dev-server  | [schema.json](./src/lib/dev-server/schema.json)  |

## How to

### Esbuild Plugins

Add a `plugins` array in your `angular.json` at `projects.<name>.architect.build.options`. Each entry is a path to an ESM/TypeScript module that exports an esbuild plugin:

```typescript
// plugins/my-plugin.ts
import type { Plugin } from "esbuild"

export default {
	name: "my-plugin",
	setup(build) {
		build.onResolve({ filter: /\.custom$/ }, (args) => {
			return { path: args.path, namespace: "custom" }
		})
	},
} satisfies Plugin
```

Plugins can also be referenced as npm package names.

Examples: [projects/app/plugins](https://github.com/muuvmuuv/angular-extended-builders/tree/main/projects/app/plugins)

### Index HTML Transformer

Add an `indexHtmlTransformer` path in your `angular.json` at `projects.<name>.architect.build.options`. The module should export a default function that receives the HTML string and returns a transformed HTML string:

```javascript
// plugins/index-html-transform.mjs
export default function transform(html) {
	return html.replace("{placeholder}", "value")
}
```

Example: [projects/app/plugins/index-html-transform.mjs](https://github.com/muuvmuuv/angular-extended-builders/tree/main/projects/app/plugins/index-html-transform.mjs)

### Dev Server Middlewares

Add a `middlewares` array in your `angular.json` at `projects.<name>.architect.serve.options`. Each entry is a path to a module that exports a Vite-compatible middleware function:

```typescript
// plugins/my-middleware.ts
import type { IncomingMessage, ServerResponse } from "node:http"

export default function middleware(
	req: IncomingMessage,
	res: ServerResponse,
	next: (err?: unknown) => void,
) {
	// Handle request or call next()
	next()
}
```

## Version Compatibility

The major and minor version of this library aligns with the supported Angular version:

| angular-extended-builder | Angular | Node.js  |
| ------------------------ | ------- | -------- |
| 22.x                     | 22.x    | >= 22.22 |
| 21.x                     | 21.x    | >= 22    |
| 20.x                     | 20.x    | >= 20    |

Patch releases contain bug fixes and enhancements only. Major and minor releases follow Angular's release cycle.

---
_Source: https://npm.io/package/angular-extended-builder · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
