Skip to content

Source map URLs shouldn't be prefixed with a local path #4518

@japgolly

Description

@japgolly

Do you want to request a feature or report a bug?

Bug.

What is the current behavior?

Some libraries (i.e. nearly all created via Scala.JS) have URLs in their source maps. However when being used with webpack, webpack is prepending a ./ to all the URLs results in trillions of warnings like this:

[info] Cannot find source file 'https://raw.githubusercontent.com/scala/scala/v2.12.1/src/library/scala/collection/immutable/Vector.scala': Error: Can't resolve './https://raw.githubusercontent.com/scala/scala/v2.12.1/src/library/scala/collection/immutable/Vector.scala' in '/home/golly/projects/misc/target/scala-2.12/scalajs-bundler/main'
[info]  @ ./fastopt-launcher.js 1:0-91
[info] 
[info] WARNING in ./demo-fastopt.js
[info] Cannot find source file 'https://raw.githubusercontent.com/scala/scala/v2.12.1/src/library/scala/collection/immutable/List.scala': Error: Can't resolve './https://raw.githubusercontent.com/scala/scala/v2.12.1/src/library/scala/collection/immutable/List.scala' in '/home/golly/projects/misc/target/scala-2.12/scalajs-bundler/main'
[info]  @ ./fastopt-launcher.js 1:0-91
[info] 
[info] WARNING in ./demo-fastopt.js
[info] Cannot find source file 'https://raw.githubusercontent.com/scala/scala/v2.12.1/src/library/scala/collection/immutable/Stream.scala': Error: Can't resolve './https://raw.githubusercontent.com/scala/scala/v2.12.1/src/library/scala/collection/immutable/Stream.scala' in '/home/golly/projects/misc/target/scala-2.12/scalajs-bundler/main'
[info]  @ ./fastopt-launcher.js 1:0-91
[info] 
[info] WARNING in ./demo-fastopt.js
[info] Cannot find source file 'https://raw.githubusercontent.com/scala/scala/v2.12.1/src/library/scala/collection/immutable/StringOps.scala': Error: Can't resolve './https://raw.githubusercontent.com/scala/scala/v2.12.1/src/library/scala/collection/immutable/StringOps.scala' in '/home/golly/projects/misc/target/scala-2.12/scalajs-bundler/main'
[info]  @ ./fastopt-launcher.js 1:0-91
[info] 
[info] WARNING in ./demo-fastopt.js
[info] Cannot find source file 'https://raw.githubusercontent.com/scala/scala/v2.12.1/src/library/scala/collection/immutable/WrappedString.scala': Error: Can't resolve './https://raw.githubusercontent.com/scala/scala/v2.12.1/src/library/scala/collection/immutable/WrappedString.scala' in '/home/golly/projects/misc/target/scala-2.12/scalajs-bundler/main'
[info]  @ ./fastopt-launcher.js 1:0-91

And resulting in a final source map that no longer works for those libraries.

If the current behavior is a bug, please provide the steps to reproduce.

Setup any dummy project with Scala.JS and scalajs-bundler which runs everything through webpack.

What is the expected behavior?

Source map links that can be identified as absolute URLs should be used as is, without modification.

I believe the fix would be a very simple test like this before prepending:
https://github.com/jantimon/html-webpack-plugin/pull/619/files

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

Using webpack 2.2.1, Node.JS 7.7.3.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions