Earlier today I tweeted:
I want to use node modules in my existing requirejs browser app. What’s the right path?
This was really understating the problem I'm trying to solve. I need a way to share modules across various JS (browser) applications. Some of these applications are RequireJS apps, and changing them away from that is probably not on the table. Others are newer applications where we have a choice when it comes to the build system -- common choices of late seem to be browserify and webpack.
I want to be able to maintain a set of modules separate from these projects that can be used by these projects. The requirements, then, are:
- Modules must be usable by a CommonJS-based module/build system, such as Browserify or Webpack.
- Modules must be usable by an AMD-based module/build system, such as RequireJS.