export.js: Export in all CommonJS environments

Closes #521
I'm following what was written for the whole file before this PR.