Flotr2 has dependency of underscore and it also ships with older version of underscore(1.1.7) but my project requires latest version of underscore (1.7.0) and both thing conflicts.
Is there any work around? Thanks in advance.
Flotr2 has dependency of underscore and it also ships with older version of underscore(1.1.7) but my project requires latest version of underscore (1.7.0) and both thing conflicts.
Is there any work around? Thanks in advance.
Copyright © 2021 Jogjafile Inc.
Flotr2
by the looks of it only uses a portion ofunderscore
(that probably being the reason the dev chose to include it in the source).Generally speaking javascript is perfectly fine with overwriting global variables. Meaning not that you should make a habit of it, but that it's syntactically legal. Thus you can simply include the latest
underscore
after you've importedFlotr2
:Here's a fiddle based off of the Flotr2 docs demonstrating this (console should be printing Underscore's version as 1.7 -- notice that if you swap the two
<script>
tags it will print 1.1.7 asFlotr2
's import will overwrite the global_
)CDN friendly version: http://jsfiddle.net/jfmdz399/ (/1/)