

Require.js is a Terrible Idea - mrpoptart
http://simplestexplanation.com/2013/08/require-js-is-a-terrible-idea/

======
avolcano
This is depressingly ill-informed.

Require.js has an optimizer that does exactly what the author suggests:
[http://requirejs.org/docs/optimization.html](http://requirejs.org/docs/optimization.html)

The point is to build your application using AMD, using individual assets in
development, and then run the optimizer - which concats and adds a loader -
for production.

Alternatively, you can even go a step simpler and always use concatenated
files, along with a minimal loader like Almond.js[1]. If you do this, you'll
probably want to use something that adds source maps for your concatenated
file (for easier debugging), but that's easy - you can use grunt-concat-
sourcemap[2] or a similar plugin for whatever build system you like.

[1]: [https://github.com/jrburke/almond](https://github.com/jrburke/almond)

[2]: [https://github.com/kozy4324/grunt-concat-
sourcemap](https://github.com/kozy4324/grunt-concat-sourcemap)

------
joebeetee
Totally misses the point of Require JS - modularisation of code, dependancy
management, namespacing, etc - beside the fact that it comes with an awesome
optimiser that does mashes everything into one script anyway...

------
lightblade
Even without require.js' r.js optimization tool, having multiple source files
like this is not necessarily a bad thing. Smaller files are more likely for
browsers to cache them. If you concatenate all source files into one 5MB[1]
file, it is unlikely the browser is going to cache that. This is more of a
trade off than absolute best thing.

[1]: [http://serverfault.com/questions/338722/what-is-the-
maximum-...](http://serverfault.com/questions/338722/what-is-the-maximum-file-
size-that-will-be-cached-by-a-browser)

------
gpsarakis
Minifying+concatenating is the most appealing solution for desktop browsers
which employ a rather large cache on static files, considering that a web
server is also fine-tuned to take advantage of caching (e.g.
[http://httpd.apache.org/docs/2.2/mod/mod_expires.html](http://httpd.apache.org/docs/2.2/mod/mod_expires.html)).
I am not sure though that this is the best approach for mobile devices; having
to serve a relatively large JS/CSS file with (possible) network interruptions
may increase page load time.

------
m90
The link 404s for me: "It seems we can’t find what you’re looking for. Perhaps
searching, or one of the links below, can help."

~~~
bjtitus
Probably realized how poorly researched the article was and just deleted it.

