Put commonjs footer on new line in case module JavaScript file contains "//" (comment) on last line (which was causing syntax error)
In cases where modules have circular reference and partially loaded module.exports is returned, we need to make sure we copy properties from module.exports to old exports in cases where module definition uses module.exports = {};