Skip to content

tsc -w get compiles its own output again #8249

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
jrieken opened this issue Apr 22, 2016 · 7 comments
Closed

tsc -w get compiles its own output again #8249

jrieken opened this issue Apr 22, 2016 · 7 comments
Labels
Fixed A PR has been merged for this issue Suggestion An idea for TypeScript

Comments

@jrieken
Copy link
Member

jrieken commented Apr 22, 2016

TypeScript Version:

1.8.10

Code

{
    "compilerOptions": {
        "module": "commonjs",
        "target": "ES6",
        "noLib": true,
        "outDir": "out"
    },
    "exclude": [
        "node_modules"
    ]
}

Have a file extension.js and run once tsc -p jsconfig.json which gives you a file out/extension.js. Start tsc in watch mode, make a change to extension.js

Expected behavior:

The compiler should auto-magically exclude the outDir.

Actual behavior:

It recurses forever which make the terminal print funny patterns
screen shot 2016-04-22 at 11 13 40

@basarat
Copy link
Contributor

basarat commented Apr 24, 2016

The compiler should auto-magically exclude the outDir.

QQ if someone already knows: What is the current behavior of

// foo.ts
console.log('hello');

With allowJs + no outDir. Is foo.js automagically excluded? 🌹

@mhegazy
Copy link
Contributor

mhegazy commented Apr 25, 2016

outDir is excluded by default if you do not specify "exclude" (node_modules behave similarly). the rational was, if we always include it, there is no way for you to disable this. with the current approach, you can not specify "exclude", and get the automatic behavior or specify one, and disable the automatic behavior.

@mhegazy mhegazy added the By Design Deprecated - use "Working as Intended" or "Design Limitation" instead label Apr 25, 2016
@mhegazy mhegazy closed this as completed Apr 25, 2016
@jrieken
Copy link
Member Author

jrieken commented Apr 26, 2016

@mhegazy So when exactly is the endless recursion a desired behaviour?

@mhegazy
Copy link
Contributor

mhegazy commented Apr 26, 2016

When you put it this way, the answer is never :)

the issue was, if we always added, some one will have a request to undo that, and there will be no way of doing this, unless we add a new flag --noImplicitOutDirExclusion (which is something we would rather not do). that is the same argument for node_modules as well.

@jrieken
Copy link
Member Author

jrieken commented Apr 27, 2016

I understand that and I think it's a fair decision, tho I think it would be better if the compiler eventually stops. Like not be triggered by a file it emitted in the previous round

@mhegazy
Copy link
Contributor

mhegazy commented Apr 27, 2016

One thing we can do, is include it by default, and then let users override that using the include property (from #5980)

@mhegazy mhegazy added Suggestion An idea for TypeScript and removed By Design Deprecated - use "Working as Intended" or "Design Limitation" instead labels Apr 27, 2016
@mhegazy mhegazy reopened this Apr 27, 2016
@basarat
Copy link
Contributor

basarat commented May 15, 2016

I've gone with : outDir is always excluded for alm

Feeding the the output of the compiler back to the input of the same compiler seems wrong. And outDir is I guess the recommended way to support allowJS alm-tools/alm#75 🌹

@mhegazy mhegazy added this to the TypeScript 2.0 milestone May 16, 2016
@zhengbli zhengbli added the Fixed A PR has been merged for this issue label May 20, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fixed A PR has been merged for this issue Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants