Specify output file

Topics: General
Feb 3, 2013 at 3:33 PM
Why on earth did you override the out function so that one can't use --module amd and specify an outputfile name, seems to me to be a bit odd?
Feb 3, 2013 at 5:38 PM
Because (as far as we can tell) it's never what you intended.

Consider some code structured like this (note: don't structure your code this way! it's wrong!)

function foo() { ... }
/// <reference path="A.ts" />
export class bar {
  // use 'foo' in here
import b = module("./B");
export class bar2 extends b.bar {
   // ... use
Before, when you compiled this set of files using --out, you'd get three files: A.js, which has function foo() in it, B.js, which has the B module, and C.js, which has the C module. The compiled code won't work, and it doesn't even make sense -- if you're using a module loader, which you must be if B.js and C.js are modules, then the only way to load A.js is as a module, but A.js isn't a module.

If you have some code structure that you were using in pre- that actually did work at runtime, we'd be interested to see it. We closed off --out/module because we couldn't figure out any code setup that worked; if it turns out we were wrong we'd definitely revisit this.

Somewhat relatedly, --out does accept a directory when doing module compilation, which might be of use to you.