We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Reduce bundle size in angular

Hello,
How it could be possible to reduce bundle size in angular? 



5 Replies

VD Vinitha Devi Murugan Syncfusion Team November 26, 2019 06:49 AM UTC

Hi Hasan 
  
Syncfusion Greetings.  
  
Could you please share the below or more detail that will be helpful for us to validate further at our end and provide a better solution as soon as possible.   
 
  • Did you faced the problem only in development or both development & production
  • Did you inject ScheduleAllModule or ScheduleModule in app.module.ts
  • Did you used webpack or angular cli application?
  • If possible share the sample or share the full code example and package version details.
Regards,  
M.Vinitha devi     
 



HR Hasan Rifaii November 26, 2019 08:07 AM UTC

Hello,

Did you faced the problem only in development or both development & production
     I have uploaded images below to compare the difference in bundle size between prod and non prod build. Nevertheless, prod bundle still large as I mentioned before

Did you inject ScheduleAllModule or ScheduleModule in app.module.ts
     Always using ScheduleModule

Did you used webpack or angular cli application?
     Angular Cli v8.3.8

If possible share the sample or share the full code example and package version details.
     Referred to the attachment below

Thank you


Attachment: reporting_c4ae3ac1.rar


VD Vinitha Devi Murugan Syncfusion Team November 27, 2019 09:15 AM UTC

Hi Hasan, 
 
Thanks for sharing the details. 
 
By default, while in production mode it optimize(compress & minify) and remove the unused, duplicate codes & modules from bundle file so that it contains less bundle size when compared to development mode because in development mode it set build Optimizer and Optimization as false(so it does not optimize the code). 
 
 
Regards, 
M.Vinitha devi 



HR Hasan Rifaii December 6, 2019 09:17 AM UTC

Hello, 
The --prod meta flag is already specified. I wondering if it's still possible to decrease the bundle less than 4mb ?

Thank you,


VD Vinitha Devi Murugan Syncfusion Team December 11, 2019 01:08 PM UTC

Hi Hasan, 
 
Yes, you can reduce the bundle size less then 3MB by setting target in “tsconfig.json” to be “es5”. Please refer below sample and screenshot. 
 
 
 
 
Tsconfig.json 
"target": "es5", 
 
Regards, 
M.Vinitha devi 


Loader.
Live Chat Icon For mobile
Up arrow icon