I'm currently integrating foreign code into our application. Part of the process, I must substitute one of their requirejs modules with ours.
Obviously I can't modify their code, otherwise I'd have to do the change at every update. What I can do is modify the main.js (data-main of requirejs).
Here is, roughly, what they have:
requirejs.config({
packages: [
'beerpong'
]
});
So they have this beerpong
package, with some modules in there. Among these modules, there is the beer.js
file. It can be required with a require('beerpong/beer')
.
Aside from this, I have my files, in a separate folder, say vodkapong/beersubstitute
. What I would like is that, whenever someone require('beerpong/beer')
, that requirejs actually serves him my vodkapong/beersubstitute
instead.
tl;dr: How can I remap an existing module to use my module instead?
PS: Sadly, we're not actually writing a beerpong game... One day maybe!