TypeStrong / atom-typescript

The only TypeScript package you will ever need
https://atom.io/packages/atom-typescript
MIT License
1.13k stars 205 forks source link

"Typescript: Build" (F6) does not ignore node_modules when told #832

Closed PhilipMay closed 6 years ago

PhilipMay commented 8 years ago

I have the following tsconfig.json:

{
  "compilerOptions": {
    "target": "es5",
    "module": "system",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": false
  },
  "filesGlob": [
    "**/*.ts",
    "**/*.tsx",
    "!node_modules/**"
  ],
  "files": [
    "app/app.component.ts",
    "app/main.ts"
  ],
  "atom": {
    "rewriteTsconfig": true
  }
}

When I hit F6 (Typescript: Build) it is looking into node_modules and thowing a compile error. In my case: node_modules/angular2/src/facade/promise.d.ts Cannot re-export name that is not defined in the module.

That should not happen cause I told him to ignore node_modules. My guess is that atom-typescript hadles "F6 build" an other way than the other builds...

If you want to test it - I have just done the Angular 2 5-min Quickstart: https://angular.io/docs/ts/latest/quickstart.html

PhilipMay commented 8 years ago

@basarat are you able to reproduce this bug?

laurelnaiad commented 8 years ago

As to excluding your node_modules dir., you might try changing it to "./nodemodules/*/_" "!./node_modules/**/*" (whoops! forgot the all important apostrophe!)

But I think that you will either have to ...

... if you want it to not complain.... otherwise Typescript will be unhappy seeing imports of the files.

Right?

PhilipMay commented 8 years ago

"!./node_modules/**/*" does not work. That way it inclused all .ts files in the tsconfig.json file (by "rewriteTsconfig": true)

PhilipMay commented 8 years ago

Well, to be honest I am not sure if this is a bug at all. I think the error message does not pop up cause atom-typescript tries to compile the node_modules/angular2/src/facade/promise.d.ts file. I think it pops up cause it tries to comple an other file that is indirectly using node_modules/angular2/src/facade/promise.d.ts and that generates the error.

I think we can close this. Sorry, I am new to this typescript topic.

basarat commented 8 years ago

I am sure this bug exists :rose: Haven't had time to look it though.

PS: I find myself struggling to maintain this project

PhilipMay commented 8 years ago

PS: I find myself struggling to maintain this project

Ohh, thats sad. Maybe you could ask one of the other contributers? Maybe @2Cu3PO42 ? I am new to this plugin TypeScript thing and can not help. https://github.com/Cu3PO42

basarat commented 8 years ago

related : https://github.com/Microsoft/TypeScript/issues/6964

pixelchutes commented 8 years ago

Adding the following to tsconfig.json seemed to do the trick for me:

"exclude": [
    "node_modules"
]
atom@1.10.2
atom-typescript@10.1.6
typescript@2.0.2