Skip to content

Comment on CommonJS require for the browser in 1kparent

Comments

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.

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

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

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.