Fixing accidental detection of require.js as common js

I changed to code to check for common js by looking for exports and module instead. Also, would it be possible to require fs inside the function where it's used?
This commit is contained in:
Nathan Breit 2013-03-21 19:23:13 -07:00 committed by SheetJS
parent f1aa13dfaf
commit cd2cd0ba0d

View File

@ -360,9 +360,11 @@ function parseZip(zip) {
var fs, jszip;
if(typeof JSZip !== "undefined") jszip = JSZip;
if(typeof require !== "undefined") {
if(typeof jszip === 'undefined') jszip = require('./jszip').JSZip;
fs = require('fs');
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
if(typeof jszip === 'undefined') jszip = require('./jszip').JSZip;
fs = require('fs');
}
}
function readSync(data, options) {