Hank Rearden
Hank Rearden

Reputation: 95

'Uncaught ReferenceError: exports is not defined' when loading typedarray module

I am trying to load the typedarray polyfill module:

https://github.com/substack/typedarray

in my app, like this (requireJS):

define(['typedarray'], function (ta) {
    ..

    var Uint8Array = ta.Uint8Array;
    var byteArray = new Uint8Array(byteNumbers);
    ..
});

The app compiles without problems but at runtime I get:

index.js:264 Uncaught ReferenceError: exports is not defined

Which is caused by this line in the polyfill's index.js:

exports.ArrayBuffer = exports.ArrayBuffer || ArrayBuffer; 

How do I fix this? Any help is very much appreciated!

Upvotes: 0

Views: 152

Answers (1)

Hank Rearden
Hank Rearden

Reputation: 95

My bad! I used the wrong version. When using the compiled version for use in browsers it works. Although the polyfill doesn't work with the Blob object which was the my main purpose :-(

Upvotes: 0

Related Questions