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

Sourcemap (.map) files get revisioned with different hash

Open stsvilik opened this issue 7 years ago • 3 comments

Description

After running gulp-rev on a directory which contains javascript files with associated .map files, revisioned files assign different hash to .map files thus disconnecting them from the associated source files.

Ex. app.js + app.js.map -> rev -> app-87c01c72f1.js + app-f385539b69.js.map

Steps to reproduce

Run gulp rev on a directory which contains source + map files.

stsvilik avatar Jan 10 '18 23:01 stsvilik

Looking at the code I see that you attempt to extract source file from source map, which in most cases would be relative where pathMap hash uses absolute paths. This causes a mismatch of .map to its related source.

stsvilik avatar Jan 10 '18 23:01 stsvilik

There are two more discrepancies that would prevent source maps from working:

  1. Source Map file still points to original non-hashed file name
  2. Source File is not pointing to hashed .map file.

stsvilik avatar Jan 11 '18 18:01 stsvilik

Are you sure the line endings are consistent in the JS files?

XhmikosR avatar Oct 22 '18 07:10 XhmikosR