So, I am writing an application with the node/express + jade combo.
I have client.js
, which is loaded on the client. In that file I have code that calls
This is because require()
does not exist in the browser/client-side JavaScript.
Now you're going to have to make some choices about your client-side JavaScript script management.
You have three options:
tag.CommonJS client side-implementations include:
(most of them require a build step before you deploy)
You can read more about my comparison of Browserify vs (deprecated) Component.
AMD implementations include:
Note, in your search for choosing which one to go with, you'll read about Bower. Bower is only for package dependencies and is unopinionated on module definitions like CommonJS and AMD.
Hope this helps some.