Merge pull request #1 from timsnadden/master

Add 'g' flag so that regex works on multiple shim init functions.
Serialize functions in requireConfig after JSON.stringify to prevent potential problems with CRLF.