Typescript AMD Modules for Node.js

I have the following Typescript File which i compile with AMD Modules:

import tsmx = module("../TSMX/tsmx");
tsmx.createServer(1337);

which produces the following js:

define(["require", "exports", "../TSMX/tsmx"], function(require, exports, __tsmx__) {
    var tsmx = __tsmx__;

    tsmx.createServer(1337);
})

When i try to load it in Node.js i get the following error:

(function (exports, require, module, __filename, __dirname) { define(["require ^ ReferenceError: define is not defined at Object. (C:\DB\Repo\TSMX\TSMX\TSMXTest\app.js:1:63) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:901:3

How to make this work and get "define" defined? I need AMD Modules because i will load some code in the browser.

I come from C# and AS3 where Imports/Namespaces are a lot easier so sorry if this is a amateur question.

EDIT: As recommended by http://requirejs.org/docs/node.html#nodeModules i added to the top of the file:

if (typeof define !== 'function')
{
var define = require('amdefine')(module );
}

define(function (require)
{
var dep = require('dependency');

return function () { };
});

but this gets placed inside the define call by typescript which makes it useless. Then i manually placed it outside of the define call which just resulted in an "Cannot find module 'amdefine'" error.

Just an option: You don't need to use AMD on node. Compile your node files separately from your browser files. Use AMD for browser.

If you still want to use AMD on node code this might help: http://nodejs.org/docs/v0.5.0/api/modules.html

I haven't used node yet, but in the browser define / require are defined in a third party library e.g. requirejs : http://requirejs.org/ demo : http://www.youtube.com/watch?v=4AGQpv0MKsA