Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with paths in Source Map files #14

Open
thanpolas opened this issue Nov 4, 2013 · 0 comments
Open

Issue with paths in Source Map files #14

thanpolas opened this issue Nov 4, 2013 · 0 comments

Comments

@thanpolas
Copy link
Owner

The sourceMap file is generated by the Google Closure Compiler (GCC). GCC does not -yet- provide a way to mangle with the paths in the sources key of the sourceMap file. As a result the mappings will not work.

Suppose your Javascript application is under the folder js/ and the build output and sourceMap file is in the folder dist/. The generated sourceMap sources key will look like this:

{
  "version":3,
  "file":"dist/app.min.js",
  "lineCount":561,
  "mappings":"KAFJ,CAAR;",
  "names":["a","b"],
  "sources":[
    "js/vendor/jquery.min.js",
    "js/vendor/handlebars.min.js",
    "js/app.js"
  ]
}

As the paths are relative and the sourceMap file was accessed from the /dist/app.min.map location, your browser will be directed to look into /dist/js/app.js instead of /js/app.js.

Right now, there are three solutions to this problem, the following one:

The symbolic-link of shame

The quick and dirty solution would be to create a symbolink link in your dist/ folder pointing to the js/ folder.

Waiting on the other solutions

The other two possible solutions is to either implement a post-processor that will manipulate the generated sourceMap file (PRs welcome!), or waiting for the ultimate solution of GCC implementing the sourceRoot option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant