3

We need to improve performance of website, that was built in angular 8

How to compress (gzip/brotli) angular file on production build?

Drake Perera
  • 49
  • 1
  • 9
  • Can you share more details? Number of components, file sizes, assets included (and their formats). Can we assume you have taken basic steps such as image compression and using common NPM modules rather custom built ones? Are you able to link to a GitHub repository? – Mike Goodstadt Jan 30 '20 at 07:48

1 Answers1

1

You can use two ways:

  1. Use the webpack compression plugin. npm i compression-webpack-plugin --save-dev

Then add the plugin to your webpack config. For example:

const CompressionPlugin = require('compression-webpack-plugin');

module.exports = {
  plugins: [new CompressionPlugin()],
};
  1. gzip all assets after the build by using gzipper

    npm i gzipper --save-dev

    ng build && gzipper dist/app --log

bas
  • 822
  • 10
  • 20