Search code examples
angularjsperformancebundleminifymeanjs

MEAN.JS: Slow charging time


Situation

I'm using MEAN.JS framework (MongoDB, ExpressJS, AngularJS and NodeJS).

I bundled and minified with grunt build all the AngularJS .js files (Controllers, Factories, Services, Directives...).

The result are 2 files:

css: 'public/dist/application.min.css',
js: 'public/dist/application.min.js'

Problem

The file application.min.js is 266kb. When a user load the web , this file takes 5 minutes delay before the page is loaded . (Using AWS EC2).

GET /dist/application.min.js 200 274.939 ms - -

274939 ms > 274.939 s > 4.58 min

The same problem was happening before the bundling and minified. I was thinking that the solution of this problem was the bundling and minified of all the AngularJS files. But isn't it.

After the .js files are loaded, the application is very fast, but takes 5min to loaded...

  • What I need to do to solve this problem? My project is large and have a lot of files, and I understand that AngularJS is for projects like this...

Solution

  • I solved the problem!

    Finally the problem isn't for the bundled and minified 266kb file!

    The problem was about the Liveload.js file. In localhost, the Liveload library is good for development, but not in the production mode that this file takes a lot of time for charging the page.

    The solution is remove the Liveload dependence.