radical-doubting / anikultura-frontend

Farmer Dashboard PWA for Anikultura using Angular and Ionic.
MIT License
2 stars 0 forks source link

Application build bundle size is large #7

Closed jgarivera closed 2 years ago

jgarivera commented 2 years ago

Describe the bug The bundle size of the built app files are a bit large (489.94 kB). It may introduce latency in poor network environments.

To Reproduce Steps to reproduce the behavior:

  1. Build the app using npm run build.
  2. See bundle size stats.

Expected behavior The bundle size of the application should be fairly small. Optimizations to reduce bundle size are definitely needed. Implement possibly gzip compression, more lazy loading, and build optimizations.

Additional context See current rundown below from previous build log. The main.js file is the biggest size contributor.

       Initial Chunk Files                        | Names              |      Size
       main.1d5486b2193256a45c1d.js               | main               | 420.65 kB
       polyfills.75e43f65f18f869cbaac.js          | polyfills          |  44.23 kB
       styles.7d43ce45a9f2d00cefda.css            | styles             |  20.20 kB
       runtime.40909088a1634a5c32f7.js            | runtime            |   4.86 kB

       | Initial Total      | 489.94 kB
jgarivera commented 2 years ago

This article may give an answer to the issue's resolution.

jgarivera commented 2 years ago

The app routing module is currently using the PreloadAllModules strategy. This may be attributed to a large bundle size.

jgarivera commented 2 years ago

More bundle size optimizations can be explored in the future. The effects of gzip compression has been dramatic and sufficient to close this issue for now.