File tree 1 file changed +5
-3
lines changed
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ function defaultGetLocalIdent(
319
319
) {
320
320
let relativeMatchResource = "" ;
321
321
322
- const { context } = options ;
322
+ const { context, hashSalt } = options ;
323
323
const { resourcePath } = loaderContext ;
324
324
325
325
// eslint-disable-next-line no-underscore-dangle
@@ -363,7 +363,6 @@ function defaultGetLocalIdent(
363
363
for ( let tier = 0 ; localIdentHash . length < hashDigestLength ; tier ++ ) {
364
364
// eslint-disable-next-line no-underscore-dangle
365
365
const hash = loaderContext . _compiler . webpack . util . createHash ( hashFunction ) ;
366
- const { hashSalt } = options ;
367
366
368
367
if ( hashSalt ) {
369
368
hash . update ( hashSalt ) ;
@@ -376,9 +375,12 @@ function defaultGetLocalIdent(
376
375
hash . update ( options . content ) ;
377
376
378
377
localIdentHash = ( localIdentHash + hash . digest ( hashDigest ) )
378
+ // Remove all leading digits
379
379
. replace ( / ^ \d + / , "" )
380
+ // Replace all slashes with underscores (same as in base64url)
380
381
. replace ( / \/ / g, "_" )
381
- . replace ( / \W + / g, "" )
382
+ // Remove everything that is not an alphanumeric or underscore
383
+ . replace ( / [ ^ A - Z a - z 0 - 9 _ ] + / g, "" )
382
384
. slice ( 0 , hashDigestLength ) ;
383
385
}
384
386
You can’t perform that action at this time.
0 commit comments