Adding support for environments without module or exports.

Change-Id: If8b9e0fdc33d7622e8fad1247fbadf7d9cb05c91