jadjoubran / laravel5-angular-material-starter

Get started with Laravel 5.3 and AngularJS (material)
https://laravel-angular.readme.io/
MIT License
1.66k stars 400 forks source link

vendor.js file size taking too long to load #375

Closed HoracioGutierrez closed 8 years ago

HoracioGutierrez commented 8 years ago

I'm sorry to bother you witht his but I'm kinda new to Angular so I might be doing something wrong that I just can't figure out. After I gulp everything, the vendor.js file weighs 3,119.45 KB and takes up to 74779ms to load which is a huge amount of time for a site to show up.

jadjoubran commented 8 years ago

Hi @HoracioGutierrez That's the size of all the dependencies unminified, which means they are in development mode with all the comments.. For example angular has all the development comments and that's why you have a huge file.. Normally before deploying to production (or staging), you would run gulp --production which will generate a minified version of all of these assets

HoracioGutierrez commented 8 years ago

Right, I totally forgot to give it the --production option to gulp. Still, once it's minified it mix all the files into a final.js now and it weighs 734kb right out of the box. If one compares it to the one in the demo site which is 205kb(vendor.js) and 2.8 KB(partials.js). Anything else I might be missing?

jadjoubran commented 8 years ago

@HoracioGutierrez which version are you using right now? You might have added additional bower packages

HoracioGutierrez commented 8 years ago

Well, since I tried it right before submitting the issue so I could get a fresh install without doing anything else than the steps in the docs I'm using v3.3:

Installing jadjoubran/laravel5-angular-material-starter (3.3.0)

  • Installing jadjoubran/laravel5-angular-material-starter (3.3.0) Downloading: 100%

And everything that it's fetching into dependencies are:

"dependencies": { "angular": "~1.5", "angular-ui-router": "~1.0.0-alpha.3", "ngstorage": "~0.3.10", "angular-material": "~1.0.8", "restangular": "~1.5.2", "angular-loading-bar": "~0.9.0", "satellizer": "^0.14.0" }

jadjoubran commented 8 years ago

The vendor on laravel-angular.io is actually 700 kb.. so there's nothing wrong on your end Unfortunately that's the overhead with Angular and all the libraries In Angular 2 you could do tree shaking to get rid of the unused code and you can also compile your templates offline in order not to ship the compiler to the browser which is super cool