Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Angular Package Format (APF) is the package structure and metadata Angular uses to distribute framework and library code through npm. It gives TypeScript, package resolvers, and build tools predictable public imports, JavaScript modules, and type declarations. If you publish an Angular library, build it with Angular CLI and ng-packagr, expose a deliberate public API, and use partial compilation so consuming applications can compile it with their Angular version.
What is the Angular Package Format?
APF is Angular’s specification for the files and metadata in an npm package. Angular packages such as @angular/core and many third-party libraries use it. It is not a separate runtime or framework: it describes how a package is organized and how tools find the code and types consumers import. Angular evolves APF alongside Angular major versions, so package authors should follow the current guide rather than assume the format never changes. Angular Package Format
The format is designed to work with Angular CLI and other JavaScript build tools. Its predictable entrypoints and module metadata help tools resolve packages, optimize application bundles, and support development workflows.
Free tools Windows power users keep installed
One-click scans. No signup required.
How an APF package exposes code and types
A package’s package.json is central to resolution. In the current documented format, a simplified package can include flattened JavaScript modules in fesm2022/, declarations in types/, and source maps. The manifest’s exports map identifies public entrypoints and maps them to runtime files and TypeScript declarations. It can also expose non-JavaScript assets through conditional exports. The exact contents of a real package depend on its entrypoints and build.
#1 Best Overall
type: "module"identifies the package as using ECMAScript module syntax.exportsis the modern map for package entrypoints and their resolved files.sideEffectscommunicates whether files have side effects, information optimizers can use when removing unused code.moduleandtypingsare legacy resolution fields shown for compatibility with tools that do not useexports; Angular describes them as deprecated as support forexportsrolls out.
Angular’s current guide documents ES2022 as the JavaScript language level for the package output. That is distinct from ESM: ESM describes the import/export module system, while ES2022 describes language features. Angular CLI and other application build tools can down-level output for the browser targets configured by an application. Angular Package Format documentation
What is an Angular package entrypoint?
An entrypoint is a public import path into a package. The primary entrypoint is the package root; secondary entrypoints provide additional public subpaths, such as @angular/core/testing or my-lib/button. Consumers should use these documented paths rather than deep-importing implementation files, which can change without being part of the supported API.
Rank #2
Choose entrypoints around coherent capabilities
Entrypoints define API boundaries and can also be lazy-loading boundaries: bundlers often split code at ES-module boundaries. APF commonly flattens each entrypoint into one ES module, so a single entrypoint can limit the granularity available for splitting. Organize entrypoints as the smallest logically connected groups that make sense; a library with one focused purpose may appropriately have just one.
Expose and connect entrypoints deliberately
In a CLI-generated library, public-api.ts defines what consumers can import. To add a secondary entrypoint, create a directory with its own ng-package.json and public API file; ng-packagr derives the package subpath from that directory. When one entrypoint refers to another, use the package import path, not a relative path between entrypoint directories, and avoid circular dependencies. Creating libraries Creating secondary entrypoints
Rank #3
Why published libraries should use partial compilation
Angular libraries intended for independent publication should use partial compilation. It emits a stable intermediate representation instead of tying the library to fully compiled instructions for one exact Angular runtime version. During an application build, Angular CLI converts that representation to fully compiled code using the consumer application’s Angular compiler. This lets a published library be consumed across supported Angular versions without publishing version-specific full-Ivy output. Angular Package Format documentation
The Angular compiler options distinguish the two modes:
Rank #4
partialis the stable intermediate format intended for published libraries that may be used by applications on different Angular versions.fullgenerates fully AOT-compiled output for the Angular version being used. It can suit a library built alongside its application with the same Angular version, for example in a monorepo, when version skew is not a concern.
Do not treat full-Ivy output as a general publishing optimization. The generated instructions are version-specific and are not a public API. Angular compiler options
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallHow to build and publish an Angular library
Angular’s documented workflow uses Angular CLI and ng-packagr. The library builder uses ng-packagr to produce an APF-compliant package; the current CLI build documentation identifies the builder as @angular/build:ng-packagr. Use a production build for distribution, inspect the generated package, and publish that output to npm. Creating libraries CLI build
- Generate or configure the library. Use the Angular CLI library workflow. Its primary package configuration is
ng-package.json, which identifies the library entry file, commonlysrc/public-api.ts. - Define the public API. Export supported symbols from the public API file. Add secondary entrypoints only for distinct, coherent capabilities, each with its own
ng-package.jsonand public API file. - Set compilation and dependency metadata. Use partial compilation for an independently published package. Declare Angular framework packages the library uses as peer dependencies, and set a peer version range that reflects the Angular versions the library intends to support.
- Build for distribution. Run the library’s production build using the CLI library builder and review the resulting
distpackage before publishing. - Publish the production package. Publish the built package to npm. Consumers install it with their package manager and import its documented public paths; for many libraries,
ng addcan also run package schematics to configure project integration.
Angular framework packages should be peers rather than ordinary library dependencies so the application and library use the same Angular module instance. Bundling Angular as a regular dependency can introduce a duplicate instance and runtime problems. Library peer dependencies
The generated package can include assets such as Sass mixins or CSS, but these must be exposed through package exports if consumers are expected to import them. Check the final package for the files and declarations your documentation promises. Managing library assets
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.How to evaluate an Angular package
When reviewing a library you did not build, inspect the published package and its manifest against the intended consumer use:
Quick Recap
- Public API: Are supported import paths documented and logically grouped, or does usage require brittle deep imports?
- Compilation compatibility: Is an independently published library partial-compiled, and does its Angular peer dependency range match the versions it claims to support?
- Resolver metadata: Does
exportsmap each public path to runtime code and declarations? Are legacy fields present only when compatibility needs justify them? - Optimization metadata: Is
sideEffectsaccurate, and can consumers import only the entrypoints they need? - Distribution completeness: Does the production package contain declarations, assets, README files, and other files promised to consumers?
- Dependency ownership: Are Angular framework packages declared as peers where required?
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

