0

In my backend I use Node.js together with Require.js in this way:

define([
    //Packages
    'express',
    'http'
],
function (
    express,
    http
) {
   //Do something with express and http
});

In my front-end I use r.js to concatenate all the files in one big file and to uglify it. I would like to do the same thing here.

The problem on the backend is that in this case, since NodeJs has it's own module-loader, Node itself is able to find express in the node_modules folder but r.js instead search for express only in the main folder ./express.js and not in /node_modules/express/index.js

How can I tell r.js to look also on the node_modules folders ?

Matteo Cardellini
  • 876
  • 2
  • 17
  • 41

1 Answers1

0

You could try to pass the paths option in your requirejs options in your grunt file. If you define path from your node_modules folder r.js should pick it up.

amiramw
  • 506
  • 2
  • 10