This project is read-only.

Build error when using External modules AMD

Topics: General
Mar 8, 2013 at 8:24 PM
So in short this is the error:

Error 1 The command "tsc --comments --module AMD --sourcemap --target ES3 "D:\xampp\htdocs\TestAppTS\TestAppTS\log.ts" "D:\xampp\htdocs\TestAppTS\TestAppTS\app.ts"" exited with code 1.

And this is is the case:

File app.ts:
 import log = module("log"); 
File log.ts:
export function message(s: string) { console.log(s); }
Each of the two files compiles to js on save.

But after build and preview in browser:
Uncaught ReferenceError: define is not defined in app.js

Here are the generated js files:

define(["require", "exports", 'log'], function(require, exports, __lib__) {
    var lib = __lib__;;
define(["require", "exports"], function(require, exports) {
    function foo() {
        return 'bar';
    } = foo;
So am I missing something, or this is a bug ?
Mar 9, 2013 at 3:51 PM
Well, strangely after clean, and restart the project builds, but there is new problem.

When two or more import are set, like :
import Alarmer = module("Alarmer");
import Logger = module("Logger");
result in this after compile:

define(["require", "exports"], function(require, exports) {

Some times it compiles to:
define(["require", "exports", "Alarmer"], function(require, exports, __Alarmer__) {
Isn't the right compile thing that is expected:
define(["require", "exports", "Alarmer", "Logger"], function(require, exports, __Alarmer__, __Logger__) {
Mar 12, 2013 at 4:42 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.