Avoid reassing module.exports on CommonJS modules

Replaced `module.exports = {...}` with `Object.defineProperties`.

Fixes #947