-
Notifications
You must be signed in to change notification settings - Fork 68
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
sourcemap messed up #63
Comments
+1 |
4 similar comments
+1 |
+1 |
+1 |
+1 |
+100 |
any update with this feature? thanks !!! |
+1 |
1 similar comment
+1 |
Ran into this myself, and noticed that the line #s reported by the mapping was pretty much exactly 2x what it should be in the resulting post-include file. Verdict: this is caused by the source file line endings being CRLF. As a result, every line # reference is counted twice. Not sure how to fix this within gulp-include (@wiledal), but workarounds:
Example of the second below.
|
+1 |
Now I get an error on one of my tasks when I use sourcemapping:
The error goes away and it compiles file if I comment out the sourcemapping parts:
Perhaps it's because |
@skeddles Did you ever figure out this issue? Been running into this two years later, over and over again. And like you, if I comment out sourcemaps, it goes away:
And yeah, I've wondered the same thing about promises, since it mentions issues with async completion. Here's my current init code: function js() {
return gulp.src(globs.build.js)
.pipe(sourcemaps.init())
.pipe(include(config.js)).on('error', console.log)
.pipe(rename({suffix: '.min'}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(dist.js))
.pipe(tap(file => alert.success(file)))
.pipe(browsersync.stream());
}; |
unfortunately I resorted to just not using sourcemaps for js |
So basically the only way for a correct mapping is to have one include with no other code in js file. Adding anything gives an incorrect map for everything beyond the first include or first lines of code whichever comes first.
Here is an example of the issue. To build
npm install
andgulp
(orgulp watch
). And then open index.html in chrome. Check the lines referenced by the console in devtools.As you can see in the photo, the mapping is wrong.
The text was updated successfully, but these errors were encountered: