gulp-rev
gulp-rev copied to clipboard
Sourcemap (.map) files get revisioned with different hash
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.
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.
There are two more discrepancies that would prevent source maps from working:
- Source Map file still points to original non-hashed file name
- Source File is not pointing to hashed
.mapfile.
Are you sure the line endings are consistent in the JS files?