{"action":"created","issue":{"url":"https://api.github.com/repos/ivogabe/gulp-typescript/issues/377","repository_url":"https://api.github.com/repos/ivogabe/gulp-typescript","labels_url":"https://api.github.com/repos/ivogabe/gulp-typescript/issues/377/labels{/name}","comments_url":"https://api.github.com/repos/ivogabe/gulp-typescript/issues/377/comments","events_url":"https://api.github.com/repos/ivogabe/gulp-typescript/issues/377/events","html_url":"https://github.com/ivogabe/gulp-typescript/issues/377","id":165959671,"number":377,"title":"tsProject.src() throws errors (gulp.src() doesn't) when using tsconfig.json without \"exclude node_modules\" section","user":{"login":"kimbaudi","id":1864092,"avatar_url":"https://avatars.githubusercontent.com/u/1864092?v=3","gravatar_id":"","url":"https://api.github.com/users/kimbaudi","html_url":"https://github.com/kimbaudi","followers_url":"https://api.github.com/users/kimbaudi/followers","following_url":"https://api.github.com/users/kimbaudi/following{/other_user}","gists_url":"https://api.github.com/users/kimbaudi/gists{/gist_id}","starred_url":"https://api.github.com/users/kimbaudi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kimbaudi/subscriptions","organizations_url":"https://api.github.com/users/kimbaudi/orgs","repos_url":"https://api.github.com/users/kimbaudi/repos","events_url":"https://api.github.com/users/kimbaudi/events{/privacy}","received_events_url":"https://api.github.com/users/kimbaudi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ivogabe/gulp-typescript/labels/Question","name":"Question","color":"5319e7"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-07-17T04:20:44Z","updated_at":"2016-10-25T18:29:34Z","closed_at":"2016-07-25T17:33:35Z","body":"<!--\r\nBefore submitting an issue, check that the following questions can be answered with yes:\r\n\r\n- Is this related to gulp-typescript, and not to TypeScript?\r\n- Is the behavior of gulp-typescript different than the behavior of tsc?\r\n- There was no similar issue already opened? (Please don't bump old closed issues)\r\n\r\nIf you can answer all these questions with yes, add a description of your issue here and fill in the related sections below.\r\n-->\r\n\r\n**Expected behavior:**\r\n\r\nI expected `tsProject.src()` and `gulp.src()` to compile .ts files without throwing a bunch of syntax errors from `node_modules` when using `tsconfig.json` without adding \"exclude node_modules\" section in `tsconfig.json`.\r\n\r\n**Actual behavior:**\r\n\r\n`tsProject.src()` throws a bunch of syntax errors from `node_modules` (i.e., .d.ts error TS1005: '=' expected, ';' expected). However, `gulp.src()` works fine. The only way to get `tsProject.src()` to work is to add \"exclude node_modules\" section to `tsconfig.json`. I can leave it out when using `gulp.src()`. Why is that? \r\n\r\n**Your gulpfile:**\r\n\r\n```javascript\r\nvar tsProject = ts.createProject('tsconfig.json');\r\n\r\ngulp.task('script', function () {\r\n    var tsResult = tsProject // tsProject throws errors, but gulp doesn't \r\n        .src(['wwwroot/app/**/*.ts', 'typings/index.d.ts'])\r\n        .pipe(ts(tsProject));\r\n\r\n    return tsResult\r\n        .js\r\n        .pipe(gulp.dest('release'));\r\n});\r\n```\r\n\r\n**tsconfig.json**\r\n\r\n```json\r\n{\r\n  \"compilerOptions\": {\r\n    \"target\": \"es5\",\r\n    \"module\": \"commonjs\",\r\n    \"moduleResolution\": \"node\",\r\n    \"sourceMap\": true,\r\n    \"emitDecoratorMetadata\": true,\r\n    \"experimentalDecorators\": true,\r\n    \"removeComments\": false,\r\n    \"noImplicitAny\": true,\r\n    \"suppressImplicitAnyIndexErrors\": true\r\n  }\r\n}\r\n```\r\n\r\n> Note: I have to add the following in `tsconfig.json` when using `tsProject.src()`, but I can leave it out when using `gulp.src()`\r\n\r\n````json\r\n,\r\n  \"exclude\": [\r\n    \"node_modules\"\r\n  ]\r\n```` \r\n\r\n**Question**\r\n\r\n- Why does `tsProject.src()` throw errors (while `gulp.src()` doesn't) when \"exclude\" isn't added to `tsconfig.json`?\r\n- What is the difference between using `tsProject.src()` and `gulp.src()` for `tsconfig.json`?\r\n- Why does the [Using tsconfig.json][1] section suggest using tsProject.src() instead of gulp.src()?\r\n\r\n```javascript\r\ngulp.task('scripts', function() {\r\n    var tsResult = tsProject.src() // instead of gulp.src(...) \r\n        .pipe(ts(tsProject));\r\n \r\n    return tsResult.js.pipe(gulp.dest('release'));\r\n});\r\n```\r\n[1]: https://www.npmjs.com/package/gulp-typescript#using-tsconfigjson"},"comment":{"url":"https://api.github.com/repos/ivogabe/gulp-typescript/issues/comments/256128289","html_url":"https://github.com/ivogabe/gulp-typescript/issues/377#issuecomment-256128289","issue_url":"https://api.github.com/repos/ivogabe/gulp-typescript/issues/377","id":256128289,"user":{"login":"ivogabe","id":4706418,"avatar_url":"https://avatars.githubusercontent.com/u/4706418?v=3","gravatar_id":"","url":"https://api.github.com/users/ivogabe","html_url":"https://github.com/ivogabe","followers_url":"https://api.github.com/users/ivogabe/followers","following_url":"https://api.github.com/users/ivogabe/following{/other_user}","gists_url":"https://api.github.com/users/ivogabe/gists{/gist_id}","starred_url":"https://api.github.com/users/ivogabe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ivogabe/subscriptions","organizations_url":"https://api.github.com/users/ivogabe/orgs","repos_url":"https://api.github.com/users/ivogabe/repos","events_url":"https://api.github.com/users/ivogabe/events{/privacy}","received_events_url":"https://api.github.com/users/ivogabe/received_events","type":"User","site_admin":false},"created_at":"2016-10-25T18:29:34Z","updated_at":"2016-10-25T18:29:34Z","body":"Your configuration is invalid, you're effectively using the stream of files as the compiler options. You should write this:\r\n```javascript\r\ngulp.task('ts', function () {\r\n    return tsProject.src()\r\n        .pipe(tsProject())\r\n        .pipe(gulp.dest(APP_BUILD));\r\n```\r\nAlso note that `tsProject.src` does not take an argument. If you want to specify a glob instead of resolving files based on your `tsconfig.json` file, you can use `gulp.src(tsFiles)`."}}
{"actor":{"display_login":"ivogabe"}}