Package.json in Angular

Package.json

During project Setup, a package.json file is installed with a comprehensive starter set of packages as specified in the dependencies and devDependencies sections.

dependencies and devDependencies

The package.json includes two sets of packages, dependencies and devDependencies.

The dependencies are essential to running the application. The devDependencies are only necessary to develop the application. You can exclude them from production installations by adding –production to the install command, as follows:

dependencies

The dependencies section of package.json contains:

Features: Feature packages give the application framework and utility capabilities.
Polyfills: Polyfills plug gaps in the browser’s JavaScript implementation.
Other: Other libraries that support the application such as bootstrap for HTML widgets and styling.

Polyfill packages

Angular requires certain polyfills in the application environment. Install these polyfills using the npm packages that Angular lists in the peerDependencies section of its package.json.

You must list these packages in the dependencies section of your own package.json.

core-js: Patches the global context (window) with essential features of ES2015 (ES6). You may substitute an alternative polyfill that provides the same core APIs. When these APIs are implemented by the major browsers, this dependency will become unnecessary.

rxjs: A polyfill for the Observables specification currently before the TC39 committee that determines standards for the JavaScript language. You can pick a preferred version of rxjs (within a compatible version range) without waiting for Angular updates.

zone.js: A polyfill for the Zone specification currently before the TC39 committee that determines standards for the JavaScript language. You can pick a preferred version of zone.js to use (within a compatible version range) without waiting for Angular updates.

Other helper libraries
angular-in-memory-web-api: An Angular-supported library that simulates a remote server’s web api without requiring an actual server or real HTTP calls. Good for demos, samples, and early stage development (before you even have a server). Read about it in the HTTP Client page.
bootstrap: Bootstrap is a popular HTML and CSS framework for designing responsive web apps. Some of the samples improve their appearance with bootstrap.

One comment on “Package.json in Angular

Leave a Reply

Your email address will not be published. Required fields are marked *