sindresorhus / gulp-rev

Static asset revisioning by appending content hash to filenames: `unicorn.css` → `unicorn-d41d8cd98f.css`
MIT License
1.54k stars 218 forks source link

rev.manifest() crashes due to Buffer.from usage #239

Closed fschlaef closed 5 years ago

fschlaef commented 6 years ago

Description

rev.manifest() "crashes" (but doesn't actually show any error) when used.

Steps to reproduce

This is because of line 156 :

manifestFile.contents = Buffer.from(opts.transformer.stringify(sortKeys(manifest), null, '  '));

This line should work, according to Node documentation : https://nodejs.org/api/buffer.html#buffer_class_method_buffer_from_string_encoding

but it does not. I tried Node 8.9.1 and 9.11.1, same result.

However, the following works :

manifestFile.contents = new Buffer(opts.transformer.stringify(sortKeys(manifest), null, '  '));

This method is marked as Deprecated though : https://nodejs.org/api/buffer.html#buffer_new_buffer_string_encoding

Any ideas ? In the meantime, I'm stuck with gulp-rev 7.1.2 :(

yuri-kovalev commented 6 years ago

I have the same situation

XhmikosR commented 5 years ago

Does this still happen with the latest Node.js 8.x/10.x?

fschlaef commented 5 years ago

I tried with 10.12 and gulp-rev 8.1.1 and 9.0.0 and everything works fine.

Weird thing is, I actually updated gulp-rev to 8.1.1 two months ago without noticing it, and it worked fine with node 9.11.1, which is exactly the same configuration I had when I opened the bug.

Anyway it works, I close this issue.