最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - RequireJS slowed down the load of my web app - Stack Overflow

programmeradmin7浏览0评论

Im just in the middle of refactoring my javascript into a modular fashion using requireJS.

I have finished and my project structure looks sweet dont get me wrong. But now publishing the app up to windows azure it now runs like a dog. Pages pop up quick but they clunk quite a bit as the dependencies on the requirejs modules e in and take effect.

Am I doing something wrong? I thought this would smooth out the loading of everything.

Has anyone e across this dilemma where they wanted modular fashioned javascript and tried to acplish this with requireJs and got a bad result?

Thanks in advance

Im just in the middle of refactoring my javascript into a modular fashion using requireJS.

I have finished and my project structure looks sweet dont get me wrong. But now publishing the app up to windows azure it now runs like a dog. Pages pop up quick but they clunk quite a bit as the dependencies on the requirejs modules e in and take effect.

Am I doing something wrong? I thought this would smooth out the loading of everything.

Has anyone e across this dilemma where they wanted modular fashioned javascript and tried to acplish this with requireJs and got a bad result?

Thanks in advance

Share Improve this question asked Aug 7, 2012 at 6:07 MattMatt 2,86311 gold badges58 silver badges102 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

What do you mean by a bad result? Has the initial page load time reduced drastically after implementing require js? If so, do you understand why it has happened?

What I mean is, without minification/concatenation having played any part in the reduction of load time, the initial page load time reduces as you might be making a request for only one js file, the require js loader and the main.js ... all your other dependencies that were loaded before dom ready are now being loaded on first use after dom ready.

You may want to read http://requirejs/docs/optimization.html for a way to minify/concatenate the files.

EDIT: if all you want is modular js, you can simply use something like the Revealing Module Pattern, RequireJS helps with the dependency management. Without RequireJS you would have to manually ensure that all your dependencies are loaded before you module code executes.

发布评论

评论列表(0)

  1. 暂无评论