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

Generates incorrect source map when one of the input files has an empty source map. #8

Open
insidewhy opened this issue May 13, 2015 · 5 comments

Comments

@insidewhy
Copy link

See gulp-community/gulp-concat#94 and gulpjs/gulp#843 (comment)

Currently gulp passes this library empty source maps which cannot be concatenated. You wanted to fix the problem here rather than in gulp-concat, I guess this would entail detecting empty source maps and replacing them with identity source maps.

@yocontra
Copy link

@ohjames just for the record - gulp doesn't pass anybody sourcemaps. gulp-sourcemaps is responsible for all of that.

@insidewhy
Copy link
Author

I know, but many plugins also touch the source map object attached to the vinyl by gulp-sourcemaps that's why I generically use the term gulp.

@floridoo
Copy link
Owner

Hi @ohjames, sorry for the late answer. I just tested your example in the gulp-concat thread and it worked fine. Could you set up a repository that shows the error you describe? Thanks!

@AStoker
Copy link

AStoker commented Oct 25, 2016

If I may breath some life into this issue, the problem reported comes from line 93 (pretty sure)(https://github.com/floridoo/concat-with-sourcemaps/blob/master/index.js#L93)

this._sourceMap.addMapping({
            generated: {
              line: this.lineOffset + i,
              column: (i === 1 ? this.columnOffset : 0)
            },
            original: {
              line: i,
              column: 0
            },
            source: filePath //This sucker right here
          });

When a source map is not included, the mapping that is used uses the file path as the source location (as opposed to sourceMap.sources[0]; if there is a source map). This results in a source location that looks like this
/Users/astoker/Sites/aurelia-cli/test-dep1/src/app.html
as opposed to this
app.html (based off the base url of src).
The result is that when you look in the source mapped version of sources in a browser, you get strange paths that separate html files from js files. Strange meaning that the html files have fully qualified path names, while the js files are defined from the root of the application.

@AStoker
Copy link

AStoker commented Oct 25, 2016

Example:
screen shot 2016-10-25 at 4 19 42 pm

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

No branches or pull requests

4 participants