I am very new to javascript, coffeescript, nodejs and overall web development and I have decided to start a nodejs project.
I have heard a lot about requirejs and asynchronously loading modules so code can be shared between client and server. I have had some trouble integrating it with my project so I found a different solution in using OneJs (which is apparently like browserify without modifying code). If I understand it properly, it compiles all of the files in the project into a single javascript package so loading doesn't become a problem.
What are pros and cons of asynchronously loading modules the Requirejs way vs loading all modules into a single javascript file the onejs/browserify way?
Tell me if I am misunderstanding anything Im still learning the technologies :)
Thanks
I don't think one file vs multiple files should matter here. RequireJS comes with a bundling tool that creates a single file with everything inside it f you want to. Tihs gives you good loading performance while still allowing you to use dynamic loading during development or when you actually need to.
I have used browserify and onejs.
onejs is very nice. it works the same way as npm.
browserify:
require(pathToModule);