

CommonJS require for the browser in 1k - stu_k
http://stuk.github.io/require1k/

======
cj
Here's a simple implementation in 20 lines of code - I use this in production
for our single page Backbone app (migrated away from Requirejs).

[https://gist.github.com/paton/ab27a1be7e843d220ee3](https://gist.github.com/paton/ab27a1be7e843d220ee3)

------
sirodoht
How does it compare to browserify? Is it a drop-in replacement?

~~~
stu_k
You run Browserify to bundle your modules offline, and then embed that bundle.
With require1k you just embed the script and use one of the API methods to
load your main module and everything is downloaded as needed. They are two
different approaches.

require1k has a limited feature set (due to its size), creates a lot of http
requests and is really suited for a small prototyping where you don't want to
set up Browserify's build process. Browserify is what you should _actually_ be
using for production sites.

~~~
lobster_johnson
I just plop Browserify into a project's routes (eg., using browserify-
middleware [1]), and have everything automatically build when the browser
requests it. With this [2], you get fast incremental builds.

[1] [https://github.com/ForbesLindesay/browserify-
middleware](https://github.com/ForbesLindesay/browserify-middleware)

[2]
[https://github.com/bjoerge/rebundler](https://github.com/bjoerge/rebundler)

------
lechevalierd3on
Would window.fetch help on saving precious bytes ?

------
stu_k
If anyone has any questions, ask away!

