From what I understand, one benefit of using AMD managing dependencies that get loaded, But in single-page application using require.js all of the dependencies will be loaded.
For example using backbone or something similar, lets say I have the following files
main.js requires router.js
router.js requires view_a.js and view_b.js
router.js renders the views
routes: {
"view_b":"b",
"view_a":"a"
},
a:function{
showView(new ViewA());
},
b:function{
showView(new ViewB());
}
Now lets say I go to example.com/#view_b
which only requires the code in view_b.js
but doesn't use anything from view_a.js
. Is there anyway to only loaded or prioritize the loading view_b.js
using require.js or something similar?