browser friendly commonJsWrapper

commonJsWrapper option was not compatible with browsers.
This patch allows template scripts could run both on node.js (CommonJS) and browsers.