{"action":"created","issue":{"url":"https://api.github.com/repos/postcss/postcss-loader/issues/390","repository_url":"https://api.github.com/repos/postcss/postcss-loader","labels_url":"https://api.github.com/repos/postcss/postcss-loader/issues/390/labels{/name}","comments_url":"https://api.github.com/repos/postcss/postcss-loader/issues/390/comments","events_url":"https://api.github.com/repos/postcss/postcss-loader/issues/390/events","html_url":"https://github.com/postcss/postcss-loader/issues/390","id":355072491,"node_id":"MDU6SXNzdWUzNTUwNzI0OTE=","number":390,"title":"Corrupt source map paths on Windows","user":{"login":"rjgotten","id":442808,"node_id":"MDQ6VXNlcjQ0MjgwOA==","avatar_url":"https://avatars2.githubusercontent.com/u/442808?v=4","gravatar_id":"","url":"https://api.github.com/users/rjgotten","html_url":"https://github.com/rjgotten","followers_url":"https://api.github.com/users/rjgotten/followers","following_url":"https://api.github.com/users/rjgotten/following{/other_user}","gists_url":"https://api.github.com/users/rjgotten/gists{/gist_id}","starred_url":"https://api.github.com/users/rjgotten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rjgotten/subscriptions","organizations_url":"https://api.github.com/users/rjgotten/orgs","repos_url":"https://api.github.com/users/rjgotten/repos","events_url":"https://api.github.com/users/rjgotten/events{/privacy}","received_events_url":"https://api.github.com/users/rjgotten/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-08-29T09:24:11Z","updated_at":"2018-08-30T15:15:13Z","closed_at":null,"author_association":"NONE","body":"### Details\r\n\r\npostcss-loader continues to produce invalid source map paths on Windows, after #224 was closed.\r\nSaid issue was pointing to css-loader as a culprit.\r\ncss-loader was fixed.\r\npostcss-loader was not.\r\n\r\n### Reproduction (Code)\r\n\r\nThe following webpack loader sequence produces valid source map paths:\r\n```js\r\n[\r\n  MiniCssExtract.loader,\r\n  \"css-loader\",\r\n  \"sass-loader\"\r\n]\r\n```\r\n\r\nThe following webpack loader sequences produces _INVALID_ paths:\r\n```js\r\n[\r\n  MiniCssExtract.loader,\r\n  \"css-loader\",\r\n  \"postcss-loader\",\r\n  \"sass-loader\"\r\n]\r\n```\r\n\r\nI have also written a small custom loader which passes through the content and sourcemap from the previous loader, while logging the sourcemap `sources` array with a simple `console.log()` call.\r\n\r\nPlacing said logger on top of sass-loader shows paths relative to the webpack project root. Placing said logger on top of postcss-loader shows the same type of corrupted paths as mentioned in #224.\r\n\r\n\r\n### Environment\r\n\r\n<!-- 👉 Please provide information about your current environment -->\r\n\r\n|OS|node|npm/yarn|package|\r\n|:-:|:--:|:-:|:------:|\r\n|Windows 10|8.9.x|6.1.x|3.0.0|\r\n"},"comment":{"url":"https://api.github.com/repos/postcss/postcss-loader/issues/comments/417356589","html_url":"https://github.com/postcss/postcss-loader/issues/390#issuecomment-417356589","issue_url":"https://api.github.com/repos/postcss/postcss-loader/issues/390","id":417356589,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNzM1NjU4OQ==","user":{"login":"michael-ciniawsky","id":5419992,"node_id":"MDQ6VXNlcjU0MTk5OTI=","avatar_url":"https://avatars0.githubusercontent.com/u/5419992?v=4","gravatar_id":"","url":"https://api.github.com/users/michael-ciniawsky","html_url":"https://github.com/michael-ciniawsky","followers_url":"https://api.github.com/users/michael-ciniawsky/followers","following_url":"https://api.github.com/users/michael-ciniawsky/following{/other_user}","gists_url":"https://api.github.com/users/michael-ciniawsky/gists{/gist_id}","starred_url":"https://api.github.com/users/michael-ciniawsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michael-ciniawsky/subscriptions","organizations_url":"https://api.github.com/users/michael-ciniawsky/orgs","repos_url":"https://api.github.com/users/michael-ciniawsky/repos","events_url":"https://api.github.com/users/michael-ciniawsky/events{/privacy}","received_events_url":"https://api.github.com/users/michael-ciniawsky/received_events","type":"User","site_admin":false},"created_at":"2018-08-30T15:15:13Z","updated_at":"2018-08-30T15:15:13Z","author_association":"COLLABORATOR","body":"@rjgotten Could you try with the following patch ? \r\n\r\n\r\nhttps://github.com/postcss/postcss-loader/blob/master/src/index.js#L157-L159\r\n```diff\r\nif (map) {\r\n-  map.file = path.isAbsolute(map.file) ? map.file : path.resolve(map.file)\r\n+  map.file = path.isAbsolute(map.file) ? map.file : path.resolve(map.file)\r\n-  map.sources = map.sources.map((src) => path.resolve(src))\r\n+  map.sources = map.sources.map((src) => {\r\n+     if (path.isAbsolute(src))\r\n+        return src\r\n+     }\r\n+\r\n+     return path.resolve(src)\r\n+  })\r\n}\r\n```\r\n"}}
{"actor":{"display_login":"michael-ciniawsky"}}