TypeScript UMD both 'module' and 'define' are undefined
<p>I transpile my TypeScript using "-m umd" because my project includes server, client and shared code. However, client side code doesn't work in browser. The browser doesn't even display any error and the breakpoint I located didn't hit, so I had to remove js-ts mapping. Then, I was able to debug it and I found the problem.</p>

<p>Following is the code that UMD generates:</p>

<pre><code>(function (factory) {
    if (typeof module === 'object' &amp;&amp; typeof module.exports === 'object') {
        var v = factory(require, exports); if (v !== undefined) module.exports = v;
    }
    else if (typeof define === 'function' &amp;&amp; define.amd) {
        define(["require", "exports", "./model"], factory);
    }
})(function (require, exports) {
    //my code
});
</code></pre>

<p>It doesn't work because both 'module' and 'define' are undefined. Therefore my code is not executed and there isn't even any exception.</p>

<p>What's wrong? How could I make it work?</p>