0

Standard NodeJS app utilising module.exports to make the code modular. We'd like to combine all of those files together into a single file a la RequireJS on the client side (which is what we use there). Does anyone know an easy way to do this server-side without wrapping everything in more module wrappers (e.g. RequireJS) e.g. command-line tool ?

Ta

N

nick-brown
  • 31
  • 2
  • 8

1 Answers1

-2

If you want to use node.js modules on the client side without additional wrappers (like RequireJS), you'll want to look into using browserify:

https://github.com/substack/node-browserify

It's a very useful build tool that allows you to use node-style require() statements and native node.js modules on the client side. Or, to quote from the github page itself:

Make node-style require() work in the browser with a server-side build step, as if by magic!

smithclay
  • 3,376
  • 1
  • 19
  • 25