Skip to content

tsc -b --watch emits unchanged js on each compilation round #35340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
IIIristraM opened this issue Nov 25, 2019 · 4 comments
Closed

tsc -b --watch emits unchanged js on each compilation round #35340

IIIristraM opened this issue Nov 25, 2019 · 4 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@IIIristraM
Copy link

IIIristraM commented Nov 25, 2019

TypeScript Version: 3.7.2

Search Terms: project references

Code

tsc -b tsconfig.json --watch

Expected behavior: each recompilation write only changed js files to output

Actual behavior: each recompilation write all js files to output in all projects

As far as I understand, files should be written by writeFileIfUpdated, but it never invoked. Instead this function called

function writeFile(fileName, data, writeByteOrderMark) {
    ts.perfLogger.logEvent("WriteFile: " + fileName);
    if (writeByteOrderMark) {
        data = byteOrderMarkIndicator + data;
    }
    var fd;
    try {
        fd = _fs.openSync(fileName, "w");
        _fs.writeSync(fd, data, undefined, "utf8");
    }
    finally {
        if (fd !== undefined) {
            _fs.closeSync(fd);
        }
    }
}

Related Issues: probably regression of #29927

Steps to reproduce:

@sheetalkamat
Copy link
Member

This is working as intended.. We do not track if change in file will not result in its output js file or not. We emit it irrespectively.

@sheetalkamat sheetalkamat added the Working as Intended The behavior described is the intended behavior; this is not a bug label Nov 26, 2019
@IIIristraM
Copy link
Author

IIIristraM commented Nov 27, 2019

@sheetalkamat, It's may be OK for this particular file, but all other js files among all projects, which are linked up through project dependency graph, are also emitted despite whether they depends on changed file or not.

For example if I have project B which depends on project A, and I change one file in A, all files from A and all files from B will be emitted

How it supposed to be integrated to any dev-build pipeline which performance usually heavily depends on amount of changed files ?

By the way the problem appears only with -b flag, tsc --watch emits only one js file, so it looks like a bug, or at least inconsistent behaviour.

@typescript-bot
Copy link
Collaborator

This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

@IIIristraM
Copy link
Author

IIIristraM commented Dec 2, 2019

Just for history, webpack was triggered by setting timestamps on all output files during project invalidation step, so there is nothing wrong with emit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

3 participants