Some changes for cjs
Merge pull request #2275 from mtwebster/cjs

Changes necessary to use cjs instead of gjs