make compatible with Broswerify

Browserify implements a subset of the fs module, so the current check passes, but it does not support readdirSync, so that call fails.
This commit is contained in:
varfoo 2014-08-12 14:48:52 -04:00
parent 2e102c72b2
commit 4cb9c0cbef

View File

@ -120,7 +120,7 @@ var g_output_modifiers = [];
if (typeof module !== 'undefind' && typeof exports !== 'undefined' && typeof require !== 'undefind') {
var fs = require('fs');
if (fs) {
if (fs && fs.readdirSync) {
// Search extensions folder
var extensions = fs.readdirSync((__dirname || '.')+'/extensions').filter(function(file){
return ~file.indexOf('.js');