Given Node.js app with a CJS requires.
app.js
// Depends on underscore
var _ = require('underscore');
var mult = require('./mult');
var app = {
x: 1,
y: 2,
multArray: function(arr){ return _.map(arr, mult); }
}
module.exports = app;
I want to optimize app.js into AMD module and instead of inlining underscore substitute it with require('cdn.underscore')
. Because in browser environment underscore will already be present with this name and I don't want to include it again.
Can I set up r.js optimizer in a way it will handle this situation?