0

I am developing a JavaScript calculator plugin that does all the mathematical operations using bignumber as I see I can manage the dependency in two ways:

  1. Include with the code base the bignumber code.
  2. Localize the dependency once the plugin is loaded and throw an error if the dependency can not be resolve. I think i can resolve in four ways: accepting it in a function, try to resolve using amd, try to resolve using commonjs, try to get it from the global object.

Has anyone try the second approach, if yes how did you did it?

Does anyone know any pattern to resolve this?

2
  • If you reference the required files in a <script src=...> block the files will be downloaded automatically, so there's no dependency problem.
    – Sebas
    Commented Apr 21, 2015 at 16:38
  • yes, but i dont take that decision. I am only making a plugin which needs another library to work, that library can be loaded in diferent ways, one such way is as you say including in the html document a script which will load the library an polute the global object. That is programmer decision. Commented Apr 22, 2015 at 6:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.