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

Undefined module for AMD loaders since 2.x

Open chrswk opened this issue 4 years ago • 2 comments

Using FileSaver.js prior to the 2.x release worked fine with AMD based loaders. Now the factory method does not return saveAs, so the AMD module is undefined.

Not sure how this would impact other loaders, but this would fix it for AMD users:

(...)
_global.saveAs = saveAs.saveAs = saveAs;

if (typeof module !== 'undefined') {
  module.exports = saveAs;
}
return saveAs;  // This would fix the problem with AMD based loaders

Thanks Chris

chrswk avatar May 08 '20 12:05 chrswk