export.js: Export in all CommonJS environments

Closes #521
This should be enough: `if ( window.document ) {`