-
Notifications
You must be signed in to change notification settings - Fork 127
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
Empty files break sourcemap #66
Comments
Actually, empty files aren't the problem but files with empty source maps (source maps whose property mappings is A bit shorter gulp file that reproduces the problem: var gulp = require('gulp');
var ts = require('gulp-typescript');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
gulp.task('default', function () {
return gulp.src('empty.ts')
.pipe(sourcemaps.init())
.pipe(ts())
.pipe(concat('app.js'))
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('release'));
}); The source map is: { version: 3,
file: 'empty.ts',
sourceRoot: '...',
sources: [ 'source.ts' ],
names: [],
mappings: '' } |
cc @floridoo |
I get this fault too with an input file that is empty, with a source map. It sounds like exactly the same case as above. I had a subsequent interest situation where the gulp-newer plugin swallowed the error, so the pipe just stopped. I've raised an issue there. It then occurred that the error out of gulp-concat isn't very useful. It doesn't tell you which file triggered the fault, for example. Would it be cool to catch these errors and augment them with the filename? I'm not sure the best practice for doing something like that. I tried a simple
Would this be a useful addition? |
Having the same issue. any update? |
This error is actually coming from a module that gulp-concat uses, not gulp-concat. Can you open this issue there? https://github.com/floridoo/concat-with-sourcemaps Include the stacktrace from the original post and link back to this issue so people here can track it there once it is created |
I could not reproduce the error. Nor with plain |
@floridoo I am having the same issue. I prepared a gist for you. Just do the following:
Then, while the watch task is running, open the |
I re-tested my gulpfile, and it does throw an error here. I used the latest releases of everything on npm. Did |
Thanks @MartinJohns! Found the issue and fixed it. It was the combination of an empty |
Can confirm, it does not crash anymore after one |
Thanks @floridoo |
@floridoo could you elaborate on this fix you made please. I am running into the issue and not sure what exactly went wrong. |
Occasionally you have a step (in my case, typescript compilation) that generates an empty file. This causes concat to fail.
Here is an example of the task that causes this failure.
While it's relatively trivial to filter empty files from a stream I believe not doing so shouldn't cause concat to tank.
The text was updated successfully, but these errors were encountered: