Do check for export first, since with browserify window is always define...

...d and no module export is done