Writing a third-party javascript code which uses underscore.js
and tries to avoid conflicts with the underscore.js version that might be used on the main site. So, my naive code is like this:
window.$MyUS = _.noConflict();
I use $MyUS
instead of _
from now on. Unfortunately, on some sites I receive the following error:
Uncaught ReferenceError: _ is not defined
What am I doing wrong?
There was a global exports
object defined, which prevented the underscore.js to be installed properly. The object has two functions declared: compile()
and compileToString()
. The functions' implementation reveals the LF
object which is most likely belongs to LiveFyre Javascript API: http://www.livefyre.com/docs/javascript-sdk-reference.
That's the investigation about the unsuccessful underscore.js installation. Still puzzled on what shall I do now and how to resolve it properly: underscore.js, global object named "exports" and livefyre javascript API - integration conflict.