gulp-coffee icon indicating copy to clipboard operation
gulp-coffee copied to clipboard

Set sourceMap file

Open nitely opened this issue 5 years ago • 4 comments

Fixes #91

The lib vinyl-sourcemaps-apply will throw an error if the sourceMap file property is not set. They seem unwilling to remove the assertion that checks for the file property.

The changes seem to work with gulp-sourcemaps, but not with the gulp v4 built in sourcemaps, which doesn't work regardless.

nitely avatar Aug 15 '20 09:08 nitely

@nitely Thanks for the PR - could you add a test for this so we can make sure sourcemaps are never broken again?

Also curious if the gulp built-in sourcemaps aren't working and you're already doing a test for this, if you do a failing test for that I can look into fixing that.

yocontra avatar Aug 15 '20 21:08 yocontra

err, I checked the tests and they do test the sourcemaps are generated. I reverted the changes and ran the tests, and they pass (as I remembered).

The sourcemaps are generated, the file property is set. So, I went back to my project to try and reproduce the issue again. I found the only way to reproduce it is to pass the transpile option. Using babel at a later stage works just fine as a workaround, ex: .pipe(babel({presets: ['@babel/preset-env']})).

About the gulp built in sourcemaps, I found the dest function requires to pass { sourcemaps: true } as well, ex: .pipe(dest('output/', { sourcemaps: '.' }) to generate external sourcemaps, or .pipe(dest('output/', { sourcemaps: true })); to geenrate inlined sourcemaps. Otherwise they are not generated. It's in the docs.

nitely avatar Aug 16 '20 07:08 nitely

@nitely Yeah that is expected - if you use just the gulp sourcemaps does this work or is the PR still needed?

yocontra avatar Aug 18 '20 06:08 yocontra

The transpile option doesn't work. It throws the missing file property error when using either the gulp-sourcemaps, or the built-in sourcemaps.

gulp-babel on the other hand works fine with both gulp-sourcemaps and the built-in sourcemaps.

I can add tests for the transpile case, but I'll need to add babel as a devDependency, is that ok?

nitely avatar Aug 18 '20 10:08 nitely