Learn how to create a custom webpack config inside an Angular project using CLI Builders. This example will reduce the file size of a library.

The Angular CLI can create a new Angular project and it will handle the webpack configuration. However, there are situations where you will want to add custom webpack functionality.

For the purposes of this article, you will learn how to use the moment.js library and remove unused locales to create a smaller bundle size.

Note: moment.js is a popular library for handling date and time. However, the current project status suggests that there may be other libraries with modern approaches that may suit your project better depending on your target audience. For educational purposes in reducing bundle sizes, this article will continue to use moment.js.

In this article, you will take an existing Angular CLI-generated project and use @angular-builders/custom-webpack for a custom webpack configuration.

#webpack #angular

How To Use Custom Webpack Configurations with Angular CLI Builders
2.50 GEEK