export.js: Export in all CommonJS environments

Closes #521
Similar to the double assignment in the previous file, let's split this in two lines or using a regular if or similar.