The pipe crashes when the "file" property is missing in the "result" variable.
To Reproduce
My gulpfile.js serves as an example.
gulp.task("babel:server", function(_done) {
return gulp.src("lib/*.mjs")
.pipe(plugins.plumber(function(err) {
log.error(err);
this.emit("end");
}))
.pipe(plugins.sourcemaps.init())
.pipe(plugins.babelMinify())
.pipe(plugins.sourcemaps.write("."))
.pipe(gulp.dest("build"));
});
Actual Output
I simply run gulp babel:server and this is what happens:
[14:34:36] Using gulpfile /run/media/esau/Shared/Universidad/PTI/Weether/iot-station/gulpfile.js
[14:34:36] Starting 'babel:server'...
/run/media/esau/Shared/Universidad/PTI/Weether/iot-station/node_modules/vinyl-sourcemaps-apply/index.js:37
throw e;
^
Error: Source map to be applied is missing the "file" property
at assertProperty (/run/media/esau/Shared/Universidad/PTI/Weether/iot-station/node_modules/vinyl-sourcemaps-apply/index.js:36:13)
at applySourceMap (/run/media/esau/Shared/Universidad/PTI/Weether/iot-station/node_modules/vinyl-sourcemaps-apply/index.js:15:3)
at DestroyableTransform._transform (/run/media/esau/Shared/Universidad/PTI/Weether/iot-station/node_modules/gulp-babel-minify/lib/index.js:75:9)
at DestroyableTransform.Transform._read (/run/media/esau/Shared/Universidad/PTI/Weether/iot-station/node_modules/readable-stream/lib/_stream_transform.js:184:10)
at DestroyableTransform.Transform._write (/run/media/esau/Shared/Universidad/PTI/Weether/iot-station/node_modules/readable-stream/lib/_stream_transform.js:172:83)
at doWrite (/run/media/esau/Shared/Universidad/PTI/Weether/iot-station/node_modules/readable-stream/lib/_stream_writable.js:428:64)
at writeOrBuffer (/run/media/esau/Shared/Universidad/PTI/Weether/iot-station/node_modules/readable-stream/lib/_stream_writable.js:417:5)
at DestroyableTransform.Writable.write (/run/media/esau/Shared/Universidad/PTI/Weether/iot-station/node_modules/readable-stream/lib/_stream_writable.js:334:11)
at DestroyableTransform.ondata (/run/media/esau/Shared/Universidad/PTI/Weether/iot-station/node_modules/readable-stream/lib/_stream_readable.js:619:20)
at DestroyableTransform.emit (events.js:182:13)
Expected Output
Adding a simple condition fixing this bug leads to a successful task.
[14:35:55] Using gulpfile /run/media/esau/Shared/Universidad/PTI/Weether/iot-station/gulpfile.js
[14:35:55] Starting 'babel:server'...
[14:35:56] Finished 'babel:server' after 955 ms
[14:35:56] Starting 'babel'...
[14:35:56] Finished 'babel' after 16 μs
Stack Trace
It's in the Actual Output section.
Configuration
How are you using babel-minify?
gulp-babel-minify
babel-minify version: 0.4.3
babel version : 6.26.0
babel-minify-config: the default configuration.
babelrc:
Possible solution
Update the applySourceMap call with this code [lines 65-57]:
if (file.sourceMap) {
if (!result.map.hasOwnProperty("file")) {
result.map.file = file.sourceMap.file;
}
applySourceMap(file, result.map);
}
Additional context
Nothing to add here.
The pipe crashes when the "file" property is missing in the "result" variable.
To Reproduce
My gulpfile.js serves as an example.
Actual Output
I simply run
gulp babel:serverand this is what happens:Expected Output
Adding a simple condition fixing this bug leads to a successful task.
Stack Trace
It's in the Actual Output section.
Configuration
How are you using babel-minify?
gulp-babel-minifybabel-minify version:
0.4.3babel version :
6.26.0babel-minify-config: the default configuration.
babelrc:
Possible solution
Update the
applySourceMapcall with this code [lines 65-57]:Additional context
Nothing to add here.