TypeScript: missing import in watch mode

TypeScript Version: 2.8.0-dev.20180130

Search Terms:

Code

// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.
import a from 'a';
import b from 'b';

a();
b();
// ...

Expected behavior:

(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "a", "b"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    const a = require('a');
    const b = require('b');

    a();
    b();
    // ...
});

Actual behavior:

(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    a();
    b();
    // ...
});

Playground Link:

Related Issues: I find in watch mode, dependencies will missing, but it is fine not in watch mode, only in watch mode. I tried to write a test but I find simple test is fine even in watch mode.

I also tried latest version, it is fine in watch mode, too.

Anyone meet same issue?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20 (9 by maintainers)

Commits related to this issue

Most upvoted comments

should be out later today.