MEAN.JS: Slow charging time

冷暖自知 提交于 2019-12-11 19:34:16

问题


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...

回答1:


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.



来源:https://stackoverflow.com/questions/31653024/mean-js-slow-charging-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!