File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ const path = require("path");
88const NORMALIZE_SLASH_DIRECTION_REGEXP = / \\ / g;
99const PATH_CHARS_REGEXP = / [ - [ \] { } ( ) * + ? . , \\ ^ $ | # \s ] / g;
1010const SEPERATOR_REGEXP = / [ \/ \\ ] $ / ;
11-
11+ const FRONT_OR_BACK_BANG_REGEXP = / ^ ! | ! $ / ;
1212
1313const normalizeBackSlashDirection = ( request ) => {
1414 return request . replace ( NORMALIZE_SLASH_DIRECTION_REGEXP , "/" ) ;
@@ -22,7 +22,7 @@ const shortenPath = (path) => {
2222class RequestShortener {
2323 constructor ( directory ) {
2424 directory = normalizeBackSlashDirection ( directory ) ;
25- if ( / [ \/ \\ ] $ / . test ( directory ) ) directory = directory . substr ( 0 , directory . length - 1 ) ;
25+ if ( SEPERATOR_REGEXP . test ( directory ) ) directory = directory . substr ( 0 , directory . length - 1 ) ;
2626
2727 if ( directory ) {
2828 const currentDirectoryRegExpString = shortenPath ( directory ) ;
@@ -60,7 +60,7 @@ class RequestShortener {
6060 if ( ! this . buildinsAsModule && this . buildinsRegExp )
6161 request = request . replace ( this . buildinsRegExp , "!(webpack)" ) ;
6262 request = request . replace ( this . indexJsRegExp , "$1" ) ;
63- return request . replace ( / ^ ! | ! $ / , "" ) ;
63+ return request . replace ( FRONT_OR_BACK_BANG_REGEXP , "" ) ;
6464 }
6565}
6666
You can’t perform that action at this time.
0 commit comments