{"action":"created","issue":{"url":"https://api.github.com/repos/ivogabe/gulp-typescript/issues/395","repository_url":"https://api.github.com/repos/ivogabe/gulp-typescript","labels_url":"https://api.github.com/repos/ivogabe/gulp-typescript/issues/395/labels{/name}","comments_url":"https://api.github.com/repos/ivogabe/gulp-typescript/issues/395/comments","events_url":"https://api.github.com/repos/ivogabe/gulp-typescript/issues/395/events","html_url":"https://github.com/ivogabe/gulp-typescript/issues/395","id":171871541,"number":395,"title":"SourceMap's sourceRoot appears incorrect","user":{"login":"MeirionHughes","id":3584509,"avatar_url":"https://avatars.githubusercontent.com/u/3584509?v=3","gravatar_id":"","url":"https://api.github.com/users/MeirionHughes","html_url":"https://github.com/MeirionHughes","followers_url":"https://api.github.com/users/MeirionHughes/followers","following_url":"https://api.github.com/users/MeirionHughes/following{/other_user}","gists_url":"https://api.github.com/users/MeirionHughes/gists{/gist_id}","starred_url":"https://api.github.com/users/MeirionHughes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MeirionHughes/subscriptions","organizations_url":"https://api.github.com/users/MeirionHughes/orgs","repos_url":"https://api.github.com/users/MeirionHughes/repos","events_url":"https://api.github.com/users/MeirionHughes/events{/privacy}","received_events_url":"https://api.github.com/users/MeirionHughes/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ivogabe/gulp-typescript/labels/Bug","name":"Bug","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-08-18T10:41:47Z","updated_at":"2016-10-01T17:17:24Z","closed_at":null,"body":"I'm having trouble with getting sourcemaps to set the correct sourceRoot for files in sub-folders. \r\n\r\n**Given**\r\n`./source/folder/foo.ts`\r\n\r\n**Expected behavior:**\r\n`./dist/folder/foo.map` with \"../../source\"\r\n\r\n**Actual behavior:**\r\n`./dist/folder/foo.map` with \"../source\"\r\n\r\n**gulpfile:**\r\n```js\r\ngulp.task('compile:typescript', ['clean:typescript'], function () {\r\n    var project = ts.createProject('tsconfig.json', {\r\n        typescript: require('typescript')\r\n    });\r\n\r\n    var tsResult = gulp\r\n        .src(['source/**/*.ts'\r\n        ])\r\n        .pipe(sourcemap.init())\r\n        .pipe(ts(project));\r\n\r\n    return merge([\r\n        tsResult.dts.pipe(gulp.dest(\"dist\")),\r\n        tsResult.js\r\n            .pipe(sourcemap.write('.', { sourceRoot: '../source'}))\r\n            .pipe(gulp.dest(\"dist\"))\r\n    ]);\r\n});\r\n```\r\n\r\n**tsconfig**\r\n```json\r\n{\r\n    \"compilerOptions\": {\r\n        \"target\": \"es6\",\r\n        \"module\": \"commonjs\",        \r\n        \"sourceMap\": true,\r\n        \"noEmitOnError\": true,\r\n        \"newLine\": \"LF\",\r\n        \"declaration\": true       \r\n    },\r\n    \"exclude\": [\r\n      \"node_modules\"\r\n    ]\r\n}\r\n```\r\n\r\n**versions**\r\n```\r\n\"gulp-sourcemaps\": \"^1.6.0\",\r\n\"gulp-typescript\": \"^2.13.6\",\r\n\"typescript\": \"^2.0.0\"\r\n```\r\n\r\n\r\nApparently according to this: https://github.com/floridoo/gulp-sourcemaps#write-options (Relative Path) it should correctly set the relative path. "},"comment":{"url":"https://api.github.com/repos/ivogabe/gulp-typescript/issues/comments/250924488","html_url":"https://github.com/ivogabe/gulp-typescript/issues/395#issuecomment-250924488","issue_url":"https://api.github.com/repos/ivogabe/gulp-typescript/issues/395","id":250924488,"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-01T17:17:24Z","updated_at":"2016-10-01T17:17:24Z","body":"I did some testing, and the behaviour of gulp-typescript seems to be correct. When you use gulp-sourcemaps without any plugins, all files will have `\"sourceRoot\": \"/source/\"`.\r\n\r\nIf there is some file in a subdirectory of `source`, say `source/a/b.ts`, the source map will have `\"sourceRoot\": \"/source/\"` and `\"sources\": [\"a/b.ts\"]`. You get the same result when you use gulp-sourcemaps without any plugins, so the behaviour of gulp-typescript 3.0 is correct."}}
{"actor":{"display_login":"ivogabe"}}