{"action":"created","issue":{"url":"https://api.github.com/repos/scala-js/scala-js/issues/2489","repository_url":"https://api.github.com/repos/scala-js/scala-js","labels_url":"https://api.github.com/repos/scala-js/scala-js/issues/2489/labels{/name}","comments_url":"https://api.github.com/repos/scala-js/scala-js/issues/2489/comments","events_url":"https://api.github.com/repos/scala-js/scala-js/issues/2489/events","html_url":"https://github.com/scala-js/scala-js/issues/2489","id":162836773,"node_id":"MDU6SXNzdWUxNjI4MzY3NzM=","number":2489,"title":"Produce source maps that reference local .scala files instead of online ones","user":{"login":"jatcwang","id":4957161,"node_id":"MDQ6VXNlcjQ5NTcxNjE=","avatar_url":"https://avatars0.githubusercontent.com/u/4957161?v=4","gravatar_id":"","url":"https://api.github.com/users/jatcwang","html_url":"https://github.com/jatcwang","followers_url":"https://api.github.com/users/jatcwang/followers","following_url":"https://api.github.com/users/jatcwang/following{/other_user}","gists_url":"https://api.github.com/users/jatcwang/gists{/gist_id}","starred_url":"https://api.github.com/users/jatcwang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jatcwang/subscriptions","organizations_url":"https://api.github.com/users/jatcwang/orgs","repos_url":"https://api.github.com/users/jatcwang/repos","events_url":"https://api.github.com/users/jatcwang/events{/privacy}","received_events_url":"https://api.github.com/users/jatcwang/received_events","type":"User","site_admin":false},"labels":[{"id":28856111,"node_id":"MDU6TGFiZWwyODg1NjExMQ==","url":"https://api.github.com/repos/scala-js/scala-js/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2016-06-29T04:05:53Z","updated_at":"2018-10-07T15:03:35Z","closed_at":null,"author_association":"NONE","body":"**Was: Produce sourcemaps that can be used by 3rd party bundlers such as Webpack**\r\n\r\nCurrently scalajs links to online sources for code belonging to Scala standard libraries. \r\nThis is problematic for 3rd party bundlers such as Webpack because they do not support including sourcemaps which are on the web.\r\n\r\nI am currently authoring a JS library with Scala-js, intended to be be loaded in as a normal JS module by a Javascript-centric frontend through webpack. \r\n\r\nWith the help of [source-map-loader](https://www.npmjs.com/package/source-map-loader) Webpack can consume 3rd party sourcemaps and make sure they are included in the final sourcemap bundle. However, I am getting errors like the following because scala-js is using weblinks to the sourcemap:\r\n\r\n```\r\nWARNING in ../projectname/js/dist/elasticorm/projectname-opt.js\r\nCannot find source file 'https://raw.githubusercontent.com/scala/scala/v2.11.8/src/library/scala/collection/generic/IterableForwarder.scala': Error: Cannot resolve 'file' or 'directory' ./https://raw.githubusercontent.com/scala/scala/v2.11.8/src/library/scala/collection/generic/IterableForwarder.scala in /Users/jtcwang/Development/skedulo/projectname/js/dist/projectname\r\n```\r\n\r\nThis is related to #2276.\r\n\r\nI think a good solution is to add a scala-js option to download the Scala std library sources locally and point to them instead of using the web link. I think this can be done without the user needing to perform the cloning themselves.\r\n\r\nThe relevant section of code for this issue I found `project/Build.scala`:\r\n\r\n```\r\n          scalacOptions += {\r\n            \"-P:scalajs:mapSourceURI:\" +\r\n            (artifactPath in fetchScalaSource).value.toURI +\r\n            \"->https://raw.githubusercontent.com/scala/scala/v\" +\r\n            scalaVersion.value + \"/src/library/\"\r\n          }\r\n```\r\n\r\nI'm happy to contribute code for this, however I'll need some help to understand scala.js's build pipeline.\r\n"},"comment":{"url":"https://api.github.com/repos/scala-js/scala-js/issues/comments/427660110","html_url":"https://github.com/scala-js/scala-js/issues/2489#issuecomment-427660110","issue_url":"https://api.github.com/repos/scala-js/scala-js/issues/2489","id":427660110,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNzY2MDExMA==","user":{"login":"DominikGuzei","id":172414,"node_id":"MDQ6VXNlcjE3MjQxNA==","avatar_url":"https://avatars3.githubusercontent.com/u/172414?v=4","gravatar_id":"","url":"https://api.github.com/users/DominikGuzei","html_url":"https://github.com/DominikGuzei","followers_url":"https://api.github.com/users/DominikGuzei/followers","following_url":"https://api.github.com/users/DominikGuzei/following{/other_user}","gists_url":"https://api.github.com/users/DominikGuzei/gists{/gist_id}","starred_url":"https://api.github.com/users/DominikGuzei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DominikGuzei/subscriptions","organizations_url":"https://api.github.com/users/DominikGuzei/orgs","repos_url":"https://api.github.com/users/DominikGuzei/repos","events_url":"https://api.github.com/users/DominikGuzei/events{/privacy}","received_events_url":"https://api.github.com/users/DominikGuzei/received_events","type":"User","site_admin":false},"created_at":"2018-10-07T15:03:35Z","updated_at":"2018-10-07T15:03:35Z","author_association":"NONE","body":"@sjrd @gzm0 i tried the approach i outlined above (downloading the sourcemap files and rewrite the mappings to local files) but it fails because some of wrong mapping URLs for some third party libraries like `slinky`. I only have a very small example app but i can imagine that this might fail for other packages the same way."}}
{"actor":{"display_login":"DominikGuzei"}}