# Is @angular-devkit/build-angular ESM-only? Can you require() it?

> @angular-devkit/build-angular@22.1.7 is a CommonJS package. CommonJS — require() works on Node.js 20, 22, 24 and 26, fails on 18.

Angular Webpack Build Facade

Last verified Sep 9, 2026 against @angular-devkit/build-angular@22.1.7.

@angular-devkit/build-angular ships CommonJS only. require("@angular-devkit/build-angular") works on Node.js 20, 22, 24 and 26 but fails on Node.js 18 (ERR_REQUIRE_ESM). The package declares Node.js ^22.22.3 || ^24.15.0 || >=26.0.0. import "@angular-devkit/build-angular" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.

**Deprecated:** Angular's Webpack support is deprecated. Use the esbuild and Vite-based "@angular/build" package instead.

## What to do

1. require("@angular-devkit/build-angular") works on Node.js 20, 22, 24 and 26 but fails on Node.js 18 (ERR_REQUIRE_ESM). The package declares Node.js ^22.22.3 || ^24.15.0 || >=26.0.0.
2. From ES modules use the default import: import buildAngular from "@angular-devkit/build-angular"; then destructure. Named imports only work when Node.js can statically detect the exports.
3. TypeScript: types are bundled; install nothing extra.
4. This package is deprecated: Angular's Webpack support is deprecated. Use the esbuild and Vite-based "@angular/build" package instead.

## Facts

- Latest: 22.1.7 (Sep 2, 2026)
- Module format: CommonJS
- Last CommonJS version: 22.1.7
- TypeScript types: bundled
- Node engines: ^22.22.3 || ^24.15.0 || >=26.0.0
- Weekly downloads: 2.5M
- License: MIT

## Runtime test results for @angular-devkit/build-angular@22.1.7

Installed and executed on Sep 9, 2026 with require("@angular-devkit/build-angular") from a CommonJS file and import "@angular-devkit/build-angular" from an ES module.

| Runtime | require("@angular-devkit/build-angular") | import "@angular-devkit/build-angular" |
|---|---|---|
| Node.js 18 | fails (ERR_REQUIRE_ESM) | fails (ERR_REQUIRE_ESM) |
| Node.js 20 | works | works |
| Node.js 22 | works | works |
| Node.js 24 | works | works |
| Node.js 26 | works | works |
| Bun 1.4.0 | works | works |

## How to import @angular-devkit/build-angular

ES modules:

```js
import buildAngular from "@angular-devkit/build-angular";
```

CommonJS:

```js
const buildAngular = require("@angular-devkit/build-angular");
```

## Module format by version

Derived from the type, main and exports fields of every stable release on npm (562 versions; the newest 60 shown).

| Versions | Format | First published |
|---|---|---|
| 20.3.32 – 22.1.7 | CommonJS | Jul 9, 2026 |

## Frequently asked

**Is @angular-devkit/build-angular ESM-only?**

@angular-devkit/build-angular@22.1.7 is a CommonJS package. @angular-devkit/build-angular ships CommonJS only. require("@angular-devkit/build-angular") works on Node.js 20, 22, 24 and 26 but fails on Node.js 18 (ERR_REQUIRE_ESM). The package declares Node.js ^22.22.3 || ^24.15.0 || >=26.0.0. import "@angular-devkit/build-angular" also works because Node.js and Bun can import CommonJS from ES modules, but only the default export is guaranteed; named imports depend on Node's static analysis of the module.

**Can I import @angular-devkit/build-angular with ES module syntax?**

Yes. import buildAngular from "@angular-devkit/build-angular" works in Node.js and Bun because they support importing CommonJS modules. Named imports work only when Node.js can statically detect the exports.

**Does @angular-devkit/build-angular work in Bun?**

Yes. import "@angular-devkit/build-angular" loaded successfully in Bun 1.4.0 on Sep 9, 2026.

**Does @angular-devkit/build-angular ship TypeScript types?**

Yes. @angular-devkit/build-angular bundles its own type declarations; no @types package is needed.

## Links

- [@angular-devkit/build-angular on npm](https://www.npmjs.com/package/@angular-devkit/build-angular)
- [Source repository](https://github.com/angular/angular-cli)
- [HTML version](https://canirequire.com/package/@angular-devkit/build-angular/)
- [JSON version](https://canirequire.com/package/@angular-devkit/build-angular.json)

---

For scripts and AI agents: any package is at https://canirequire.com/package/<name>/index.md (Markdown) or https://canirequire.com/package/<name>.json (JSON); the site index is https://canirequire.com/llms.txt. Fetch the URL directly; no search needed.
