Joules: Node.js Module loading in the browser

I recently set up a dedicated domain for Joules, the library I created for Node.js-style module loading in the browser. The idea behind the library was to create something as flexible as RequireJS - which allows for very rapid development by skipping a build step, and still allows you to compile scripts into a compressed version for production - that supports Node.js modules as well as Browserify.

Joules accomplishes both of these, resulting in a Node.js-like environment for the front-end that still lets you just refresh the page to see your changes, making development faster.

Take a look at the demo to see what I mean.

Making front-end Javascript more modular is a real problem. There have been some good attempts to make it much more modular; notably Component has taken a holistic approach to modularizing the front-end, including other assets in “components”.

Joules doesn’t attempt to do anything that ambitious - it’s a module loader, and just a module loader. It is intended to perform exactly like Node’s module loader, even where it diverges from the CommonJS spec. It’s unopinionated about how you build your project, or what libraries you use.

My hope is that by having a dependable front-end module loader that takes advantage of the existing eco-system for javascript modules (NPM, and the many thousands of packages on it) developers will be able to create clean structures whatever way is best for their project.

It’s still a very young project: I haven’t written test scripts that ensure it’s adherence to Node’s module loading style, so there are almost definitely bugs that will continue to come up. That’s the biggest hurdle to making it a stable, usable library. It also lacks the core modules that are in most every Node project. While some of these are unique to a server environment, Browserify has gone a long way toward making many of these modules available in the browser. I’d like to take advantage of that work to bring core modules to the browser using Joules.

I’ll continue to develop Joules into a more mature, stable project that can be used in production. I hope that it helps some developers who were facing similar issues that I was when looking at the options available for writing modular, reusable, front-end javascript.