@@ -25,12 +25,11 @@ function getPaths(publicPath, compiler, url) {
25
25
compilers [ i ] . options . output . publicPath ;
26
26
27
27
if ( compilerPublicPath ) {
28
- if ( compilerPublicPath . indexOf ( '/' ) === 0 ) {
29
- compilerPublicPathBase = compilerPublicPath ;
30
- } else {
31
- // handle the case where compilerPublicPath is a URL with hostname
32
- compilerPublicPathBase = parse ( compilerPublicPath ) . pathname ;
33
- }
28
+ compilerPublicPathBase =
29
+ compilerPublicPath . indexOf ( '/' ) === 0
30
+ ? compilerPublicPath // eslint-disable-next-line
31
+ : // handle the case where compilerPublicPath is a URL with hostname
32
+ parse ( compilerPublicPath ) . pathname ;
34
33
35
34
// check the url vs the path part of the compilerPublicPath
36
35
if ( url . indexOf ( compilerPublicPathBase ) === 0 ) {
@@ -66,21 +65,19 @@ module.exports = {
66
65
const urlObject = parse ( url ) ;
67
66
let filename ;
68
67
68
+ const hostNameIsTheSame = localPrefix . hostname === urlObject . hostname ;
69
+
69
70
// publicPath has the hostname that is not the same as request url's, should fail
70
71
if (
71
72
localPrefix . hostname !== null &&
72
73
urlObject . hostname !== null &&
73
- localPrefix . hostname !== urlObject . hostname
74
+ ! hostNameIsTheSame
74
75
) {
75
76
return false ;
76
77
}
77
78
78
79
// publicPath is not in url, so it should fail
79
- if (
80
- publicPath &&
81
- localPrefix . hostname === urlObject . hostname &&
82
- url . indexOf ( publicPath ) !== 0
83
- ) {
80
+ if ( publicPath && hostNameIsTheSame && url . indexOf ( publicPath ) !== 0 ) {
84
81
return false ;
85
82
}
86
83
0 commit comments