Skip to content

Commit 497e482

Browse files
committed
fix consistent hash for windows
1 parent 60e5a1a commit 497e482

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/gen-id.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
var path = require('path')
44
var hash = require('hash-sum')
55
var cache = Object.create(null)
6+
var sepRE = new RegExp(path.sep.replace('\\', '\\\\'), 'g')
67

78
module.exports = function genId (file, context) {
89
var contextPath = context.split(path.sep)
910
var rootId = contextPath[contextPath.length - 1]
10-
file = rootId + '/' + path.relative(context, file)
11+
file = rootId + '/' + path.relative(context, file).replace(sepRE, '/')
1112
return cache[file] || (cache[file] = hash(file))
1213
}

0 commit comments

Comments
 (0)