I\'m trying to work with requirejs and text plugin and I have weird problem.
I have two web servers:
The documentation of the text plugin gives a hint to the solution: It's possible to configure the plugin in a way that it always fetches remote resources via XHR without appending the .js suffix and loading it via script tag. The simple solution is to always enforce using XHR:
requirejs.config({
config: {
text: {
useXhr: function (url, protocol, hostname, port) {
return true;
}
}
}
});
Note that the remote server needs to set the correct CORS header and that this could be a security issue. Thus add the necessary checks for trusted urls when using this instead of simply returning true.