

RequireJS 2.0 draft - v33ra
https://github.com/jrburke/requirejs/wiki/Requirejs-2.0-draft

======
combataircraft
RequireJS is very expensive and it's NOT CommonJS. It claims that CommonJS is
not-optimal for browser and offers you to put your source code inside of an
awkward container for optimizing. It's not smart.

Let me introduce you OneJS: <http://github.com/azer/onejs>

It simply converts any CommonJS package into a single, stand-alone JavaScript
file. It means, you can structure your client-side project just like a NodeJS
project and you can convert your NodeJS project to a single file just like a
client-side project.

Unlike Browserify, OneJS is unobtrusive [1], provides an accurate
implementation of CommonJS specs [2] and the output it produces is suitable
for splitting and having async dependencies.

[1] A chess website built with OneJS: <http://multiplayerchess.com/mpc.js>

[2] ExpressJS built with OneJS, with all dependencies:
<https://gist.github.com/2415048>

~~~
stephan83
That looks cool, will look into it. Does it support the http node core module,
like browserify?

~~~
combataircraft
Here are the core modules it supports;
<http://news.ycombinator.com/item?id=3915403>

browserify-http can be used by OneJS as well but I don't see any point of
emulating http module on client-side. I prefer using libraries supporting both
platforms, such as boxcars; <http://github.com/azer/boxcars>

------
plancien
Good news. This will very be useful in my current projets, I like the
direction taken with the "legacy config".

~~~
statenjason
I agree. I've had to wrap non-amd libs far too many times.

I wonder how this will work when optimized.

------
atjoslin
So what's the advantage of requireJS versus browserify? I like browserify
because I'm used to the node syntax

~~~
stephan83
If you use node, I'd stick with browserify. RequireJS is nice if you want to
load scripts asynchronously, but in reality your code is usually packed to one
or two files so there is no need for the asynchronous part. Plus I dislike the
RequireJS syntax, but that's personal taste.

~~~
pfraze
<http://requirejs.org/docs/node.html>

I appreciate browserify having the exact same syntax, but RequireJS can do
serverside.

~~~
stephan83
Yes but as I said I don't need async loading of scripts, since all my code is
packed in usually a single file. Therefore I don't need the RequireJS syntax,
and I'd rather stick with a simple require syntax.

~~~
darklajid
Help me, I'm still fumbling around in the web world und miss a lot.

Why would you even look at require.js if you don't have modular code/code of
your own spread over a couple of files? This is for me the one single reason
to look into it in the first place. To organize my own code better.

~~~
stephan83
I do keep my code in separate files. But my servers deliver them in a single
file using browserify (<https://github.com/substack/node-browserify>).

It's great thing that you use RequireJS to organize your code, and you should
keep doing it. We use RequireJS at work and it works pretty well. However my
personal preference is browserify, but use whatever works for you.

