-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Exclude option is not respected in tsc #7432
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
Comments
The same issue happens when using the "files" option actually. Isn't there a way to void this? |
What do your source files and dependencies look like? |
One thing to note, if this is not what you want, use |
Here's the minimal setup: a.tsimport './b'; b.tsexport = 1; tsconfig.json{
"exclude": ["b.ts"]
} and then...
I would expect |
As I mentioned in #7432 (comment), and as mentioned in https://github.com/Microsoft/TypeScript/wiki/tsconfig.json:
Now you have an |
I see your point, and I understand the reason. Still I believe something should be done. So this becomes really inconvenient with node_modules written in typescript. I don't want typescript touching my node_modules folder. Generating |
At least a way of saying |
if you do not want the compiler to resolve any files for you, use --noResolve. but that means that all your modules will not be resolved. I do not think this is the real problem. the real problem is really why you need to exclude some module typings. what is the offending file that you are trying to exclude. |
Well, I'm using TS + babel to be able to use async/await in node. So in my tsconfig file I have I have a couple of npm modules I have written myself in Typescript (one of them is called rabbitr). They are compiled to ES5 and should work fine in node. The problem is when I run |
that is the problem then. the compiler should not compiler your references. this is tracked by #6964. consider using a |
Reading this ticket, then it is good to assume to do not exclude the files under node_modules? |
I do not understand the question |
@mhegazy thank you for having a look to my question. The reason of my question is because I have an Angular 2 project using 2.0.1 and when running 'tsc' it runs the transpiling process to all my files�, .ts and d.ts under node_modules. Because of this, it throws some errors coming from some libraries (not Angular). I assume because these ones might be using different versions of TypeScript? I wanted to use the exclude option and that brought me here. What would be the best way to solve this issue? Any help would be greatly appreciated. |
if you exclude a folder (e.g. |
I've seen this be problematic when you are using npm link. When npm link is used you will see both d.ts and .ts files in the node_modules folder for your particular dependency. Then the compiler will try and resolve the imports (and compile them) which would overwrite the d.ts files, which are input files. I've been able to get around this by doing an npm pack (which honors the .npmignore file) and then extracting, and then linking the extracted package. Kind of a pain, but it works I guess. |
@mhegazy thank you very much for taking the time to explain! |
@landonpoch can you elaborate on the steps needed to npm pack, extract and link.? I am having the problem with an npm linked project. |
…onflicts Per microsoft/TypeScript#7432 the TypeScript compiler will attempt to compile the TypeScript sources if they're found. This is because definitions (.d.ts) do not take precedence over source files.
…onflicts Per microsoft/TypeScript#7432 the TypeScript compiler will attempt to compile the TypeScript sources if they're found. This is because definitions (.d.ts) do not take precedence over source files.
TypeScript Version:
1.8.7
1.8.0
1.7.5
Code
Expected behavior:
Shouldn't build any
.ts
files innode_modules
.Actual behavior:
Builds files in
node_modules
. Iftarget: es6
I get lots ofSyntaxError
s in node.The text was updated successfully, but these errors were encountered: