Vite plugin · Angular 22 · ngp

Angular on Vite, one module at a time

With vite-plugin-ngp, the dev server compiles only the Angular files a page asks for, so a 5,000-component app shows its first page in 1.6 seconds, where ng serve takes 28.4. The code still comes from Angular's own template compiler, and your templates and TypeScript are still type-checked, in a background process. Underneath is ngp, the Rust-and-TypeScript preprocessor Angular merged on 8 October 2026.

npm create @push-based/ngp@latest

Already have an Angular app? Getting started moves it to Vite.

Measured

What per-module compilation buys you

Two runs of the benchmark in the repo's bench/ folder, on different machines and months apart. Compare the plugin with the CLI inside a run, not one run's numbers with the other's.

Generated apps of 100 to 5,000 components

One laptop · Angular 22.3.0-next.2 · 17 October 2026

100–130 ms

from saving a template to the update in the page, in place, at 100 to 5,000 components, where ng serve takes 1.8 s at 5,000

Performance: Template edits

0.9 GB

held by the dev server once the page has rendered after a restart, at 5,000 components, where ng serve holds 4.7 GB

Performance: Memory

Within 3%

of ng build's production JavaScript, gzipped, at every size. The initial chunk is 16 kB larger at 5,000 components

Performance: Bundle size
0 s5 s10 s15 s20 s25 s100 componentsvite-plugin-ngpvite-plugin-ngp: median 405 ms of 5, fastest 402 ms, slowest 421 ms405 msAngular CLIAngular CLI: median 1.92 s of 5, fastest 1.91 s, slowest 1.99 s1.92 sAnalogAnalog: median 909 ms of 5, fastest 899 ms, slowest 937 ms909 ms@oxc-angular/vite@oxc-angular/vite: median 282 ms of 5, fastest 277 ms, slowest 284 ms282 ms1,000 componentsvite-plugin-ngpvite-plugin-ngp: median 453 ms of 5, fastest 446 ms, slowest 507 ms453 msAngular CLIAngular CLI: median 6.82 s of 5, fastest 6.74 s, slowest 6.85 s6.82 sAnalogAnalog: median 1.74 s of 5, fastest 1.72 s, slowest 1.76 s1.74 s@oxc-angular/vite@oxc-angular/vite: median 296 ms of 5, fastest 286 ms, slowest 318 ms296 ms5,000 componentsvite-plugin-ngpvite-plugin-ngp: median 570 ms of 5, fastest 568 ms, slowest 575 ms570 msAngular CLIAngular CLI: median 28.1 s of 5, fastest 27.8 s, slowest 28.5 s28.1 sAnalogAnalog: median 5.76 s of 5, fastest 5.75 s, slowest 5.87 s5.76 s@oxc-angular/vite@oxc-angular/vite: median 338 ms of 5, fastest 331 ms, slowest 339 ms338 msThe playground, 21 componentsvite-plugin-ngpvite-plugin-ngp: median 467 ms of 5, fastest 466 ms, slowest 491 ms467 msAngular CLIn/aAnalogAnalog: median 948 ms of 5, fastest 935 ms, slowest 965 ms948 ms@oxc-angular/vite@oxc-angular/vite: median 303 ms of 5, fastest 300 ms, slowest 313 ms303 ms
Restart to first paint, with the caches kept: medians of 5 runs per tool and app. The plugin, in violet, stays between 0.4 and 0.6 s at every size, where ng serve grows to 28.1 s.

Medians, measured end to end in headless Chrome on an Apple M2 Max, on the plugin at commit e401c10, against ng serve, Analog and @oxc-angular/vite on the same Angular.

@oxc-angular/vite restarts faster still, at about 0.3 s, and uses less memory, but it doesn't type-check and uses its own compiler.

They predate the linker over oxc, on 9 November, and the ngp built from Angular 22.3.2, on 2 December. The generated apps haven't been measured since.

How they were measured

Two open-source apps

GitHub's 4-core runners · Angular 22.3.2 · 2 December 2026

130–190 ms

from saving a template to the update in the page, in place, on both apps, where the CLIs take 3.5 to 4.5 s

Benchmarks: Editing

Medians of 5 starts and 10 edits in one workflow run: Super Productivity, 252 components with Material and NgRx, against the Angular CLI, and Ghostfolio, an Nx monorepo of 157, against Nx. Benchmarks on real apps.

Setup

One plugin in your Vite config

Install the package and Vite. The package carries its own ngp, built from Angular's source, so there's nothing else to build or point it at. Add ngp() to vite.config.ts, put your index.html in the project root with a script tag for src/main.ts, keep main.ts as ng new wrote it, and run npx vite. The same transform runs in production builds and in server rendering: this site is an Angular app compiled by the plugin and prerendered with Angular SSR.

Read the setup guide
npm install -D @push-based/vite-plugin-ngp vite@8.3.4
// vite.config.ts
import {defineConfig} from 'vite';
import {ngp} from '@push-based/vite-plugin-ngp';

export default defineConfig({
  plugins: [ngp()],
});

What works

Checks, tests, server rendering and translations too

The plugin does more than serve. Each of these works today, and its page says how it was checked.

Not everything an ng build app uses has moved: inline styles are plain CSS, there's no service worker or critical CSS inlining, and libraries you publish stay on ng-packagr. Status and limits lists what doesn't work yet.

How it works

Three steps per request

  1. Vite asks for a module

    The browser requests a .ts file, and Vite hands its code to the plugin.

  2. ngp compiles that one file

    ngp's Rust analyzer answers for that file alone, and Angular's own template compiler generates its code.

  3. Vite does the rest

    The plugin returns TypeScript and a source map. Vite strips the types, and other plugins see ordinary modules.

Compared

When to use which

Four ways to run an Angular app in development. Two compile each file when Vite asks for it, and @oxc-angular/vite does it faster than this plugin.

  • ng serve

    Compiles
    The whole program, before serving
    Compiler
    ngc
    Type-checks templates
    Yes
    Pick it if
    You ship an Angular app today and need it to keep working. Nothing here replaces it yet.
  • Analog

    Compiles
    The whole program, before serving
    Compiler
    ngc
    Type-checks templates
    Off by default; on under @analogjs/platform
    Pick it if
    You need Vite's plugins, file-based routing or a meta-framework in production. Use @analogjs/platform, so type-checking is on.

    Its opt-in fastCompile compiles per file, after a scan of every file, with its own compiler on @angular/compiler, and doesn’t type-check.

  • @oxc-angular/vite

    Compiles
    Per file, on request
    Compiler
    VoidZero’s, in Rust
    Type-checks templates
    No
    Pick it if
    You want the fastest builds and can do without template type-checking and Angular’s own compiler. Its maintainers call it experimental.
  • vite-plugin-ngp

    Compiles
    Per file, on request
    Compiler
    ngp: Angular’s analyzer and template compiler
    Type-checks templates
    Yes, in a separate process
    Pick it if
    You want per-module compilation with Angular’s own compiler and type-checking, and can stay on Angular 22.3. ngp itself is still a prototype.

Where this plugin loses. On generated apps, @oxc-angular/vite beat it on every timing but the typical template edit, where they tied, and held a quarter of its memory. What you give up for that is Angular's own compiler, template type-checking and a chunk of its own for each @defer block. And to ship an app today, use the Angular CLI.

Analog 2.8.1 and @oxc-angular/vite 0.0.41 were checked in their source and docs on 17 October 2026, and both change fast. The timings are from one laptop on the same day. Compared with alternatives has the sources, and Performance the numbers.

Try it

Start an Angular app on Vite

One command writes ng new's app on Vite, with routing, a spec and its size budgets, and installs nothing until you do.

npm create @push-based/ngp@latest