BigInteger.js icon indicating copy to clipboard operation
BigInteger.js copied to clipboard

Asynchronous Module Definition returns undefined

Open esfoden opened this issue 6 years ago • 1 comments
trafficstars

hi all, I love the BigInteger library, its fast and the BigInt polyfill mechanism is very useful.

Unfortunately it doesn't seem to work with AMD modules. Using require.js v 2.3.6:

requirejs(["./node_modules/big-integer/BigInteger"], function (big) {

the returned "big" variable is undefined. The problem seems to be at line 1450 of BigInteger.js:

define("big-integer", [], function () {

there are two problems here. Firstly it is the user of the module that names it (I named it "big" above) not the module itself and secondly "big-integer" is not a valid javascript identifier.

The solution is easy: change 1450 to:

define( function () {

and it all works beautifully. I thought I would post the issue here for verification and discussion before submitting a pull request.

esfoden avatar Nov 08 '19 23:11 esfoden

Thanks, feel free to submit a pull request.

peterolson avatar Nov 09 '19 01:11 peterolson