Skip to content

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

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
PhilipMay opened this issue Feb 3, 2016 · 8 comments
Closed

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

PhilipMay opened this issue Feb 3, 2016 · 8 comments

Comments

@PhilipMay
Copy link
Contributor

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
Copy link
Contributor Author

@basarat are you able to reproduce this bug?

@laurelnaiad
Copy link

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

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

  • (a) not reference the files in your imports, or
  • (b) stub their module declarations elsewhere in a d.ts file of your own, or
  • (c) include the d.ts files from angular in your build

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

Right?

@PhilipMay
Copy link
Contributor Author

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

@PhilipMay
Copy link
Contributor Author

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
Copy link
Member

basarat commented Feb 4, 2016

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

PS: I find myself struggling to maintain this project

@PhilipMay
Copy link
Contributor Author

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
Copy link
Member

basarat commented Feb 8, 2016

related : microsoft/TypeScript#6964

@pixelchutes
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants