I use this command:
tsc --out foo.js values/java-junit/*.ts --module amd
or
tsc --out foo.js values/java-junit/*.ts --module system
and I get
define("index", ["require", "exports"], function (require, exports) {
"use strict";
exports.__esModule = true;
var CodeGenerator = /** @class */ (function () {
function CodeGenerator() {
this.rawCode = '';
this.styledCode = '';
}
// ...
CodeGenerator.pluginName = 'java-junit';
return CodeGenerator;
}());
exports.CodeGenerator = CodeGenerator;
});
or
System.register("index", [], function (exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
var CodeGenerator;
return {
setters: [],
execute: function () {
CodeGenerator = /** @class */ (function () {
function CodeGenerator() {
this.rawCode = '';
this.styledCode = '';
}
// ...
CodeGenerator.pluginName = 'java-junit';
return CodeGenerator;
}());
exports_1("CodeGenerator", CodeGenerator);
}
};
});
my question is - is there a way to name the module with a command line option, instead of the module name being "index"?
You can use the amd-module directive at the top of the containing file to name your module:
/// <amd-module name="NamedModule"/>
export function foo() { }
Will generate:
define("NamedModule", ["require", "exports"], function (require, exports) {
function foo() { }
exports.foo = foo;
});