@@ -20,11 +20,12 @@ const hashRegexp = /Hash: [a-f0-9]+/g;
20
20
21
21
exports . replaceBase = ( template ) => {
22
22
23
- let cwd = process . cwd ( ) ;
23
+ const cwd = process . cwd ( ) ;
24
24
let webpack = path . join ( __dirname , ".." ) ;
25
25
let webpackParent = path . join ( __dirname , ".." , ".." ) ;
26
- cwd = lessStrict ( cwd . replace ( / [ - [ \] { } ( ) * + ? . , \\ ^ $ | # \s ] / g, "\\$&" ) ) ;
27
- cwd = new RegExp ( cwd , "g" ) ;
26
+ const cwdRegExpStr = lessStrict ( cwd . replace ( / [ - [ \] { } ( ) * + ? . , \\ ^ $ | # \s ] / g, "\\$&" ) ) ;
27
+ const cwdRegExp = new RegExp ( cwdRegExpStr , "g" ) ;
28
+ const cwdSlashRegExp = new RegExp ( cwdRegExpStr + "[\\/\\\\]" , "g" ) ;
28
29
webpack = lessStrict ( webpack . replace ( / [ - [ \] { } ( ) * + ? . , \\ ^ $ | # \s ] / g, "\\$&" ) ) ;
29
30
webpack = new RegExp ( webpack , "g" ) ;
30
31
webpackParent = lessStrict ( webpackParent . replace ( / [ - [ \] { } ( ) * + ? . , \\ ^ $ | # \s ] / g, "\\$&" ) ) ;
@@ -33,7 +34,8 @@ exports.replaceBase = (template) => {
33
34
return template
34
35
. replace ( / \r \n / g, "\n" )
35
36
. replace ( / \r / g, "\n" )
36
- . replace ( cwd , "." )
37
+ . replace ( cwdSlashRegExp , "./" )
38
+ . replace ( cwdRegExp , "." )
37
39
. replace ( webpack , "(webpack)" )
38
40
. replace ( webpackParent , "(webpack)/~" )
39
41
. replace ( timeRegexp , "" )
0 commit comments