gulp-sourcemaps / vinyl-sourcemaps-apply

Helper for implementing source map support in Gulp plugins
19 stars 8 forks source link

Loses source map file property #1

Closed sindresorhus closed 10 years ago

sindresorhus commented 10 years ago

See: https://github.com/Kagami/gulp-ng-annotate/commit/2dd427d54a2e14d473563fee89ed2e223cb19f40#diff-168726dbe96b3ce427e7fedce31bb0bcR16 and https://github.com/terinjokes/gulp-uglify/issues/53 and https://github.com/sindresorhus/gulp-autoprefixer/issues/2

koistya commented 10 years ago

:+1: please, fix :)

sumerokr commented 10 years ago

waiting for fix

chiefjester commented 10 years ago

+1

mahnunchik commented 10 years ago

+1

hzoo commented 10 years ago

+1

floridoo commented 10 years ago

vinyl-sourcemaps-apply does not loose the property. gulp-ng-annotate is passing a source map without the file property, so when applying this source map the result is one without the file property. The next plugin in the chain will crash because the file property is absolutely needed for the upstream source map (which is what happened to gulp-uglify, even though it was not the responsible plugin).

I published a new version that includes checks for the file property (+ mappings and sources) and throws an Error in case they are missing. This way the error is thrown in the right plugin and even if there is no plugin following it.

The error still needs to be fixed in the plugins. vinyl-sourcemaps-apply cannot do this, because it doesn't know the plugins output file name. I sent a pull request fixing it on gulp-ng-annotate.