2
votes

I've been researching different client-side Javascript modules workflows for my current Node.JS Express project, and I am having trouble deciding between using Browserify + npm + gulp vs RequireJS + Bower + gulp.

I would much rather use CommonJS rather than AMD since I like the syntax more, so on the one hand I am tempted to go with the former option... however, I really dislike the idea of sharing the same global modules for both the server and the client (what if I want to use different versions), and also, I'd rather keep my client dependencies flat rather than the way npm does it, so I prefer Bower to manage my modules... and so I am caught in this conundrum.

Is there any way to get the best of both worlds? Browserify-shim seems to be relevant... Any opinions in the matter?

1
Webpack will be able to give you CommonJS modules for your own code, and you can load external dependencies the AMD way. It's a very good manager.TbWill4321
Thanks for the tip man! I think I might just use that. Also, I came across Duo, seems like another interesting solution. I'll update this question later on after I find an answer I'm happy with laterJulian Grinblat
Take a close look at the number of commits for each options, as it will tell you how mature the solution is: Webpack has 1,481 commits, Browserify touts 2,037 commits, Require.JS has 1,319 commits. Duo has 70. Just food for thought.TbWill4321

1 Answers

0
votes

At the end I went with System.JS and jspm, and I must say it absolutely solves all the problems that I was facing, and then some, flawlessly. It took me a while until I finally found out about it, but I believe this is gonna be the defacto standard for a long while so I'd encourage anyone writing a new project to just default to jspm.

You get AMD and Common.JS and ES6 support, you don't mix your node modules and client modules (node_packages and jspm_packages), and flat dependecies... what more could you need?

Thank you for your suggestions!