File tree 2 files changed +12
-3
lines changed
examples/modus-manual-script
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ var onSocketMsg = {
89
89
} ;
90
90
91
91
var hostname = urlParts . hostname ;
92
+ var protocol = urlParts . protocol ;
92
93
93
94
if ( urlParts . hostname === '0.0.0.0' ) {
94
95
// why do we need this check?
@@ -99,8 +100,16 @@ if(urlParts.hostname === '0.0.0.0') {
99
100
}
100
101
}
101
102
103
+ // `hostname` can be empty when the script path is relative. In that case, specifying
104
+ // a protocol would result in an invalid URL.
105
+ // When https is used in the app, secure websockets are always necessary
106
+ // because the browser doesn't accept non-secure websockets.
107
+ if ( hostname && ( window . location . protocol === "https:" || urlParts . hostname === '0.0.0.0' ) ) {
108
+ protocol = window . location . protocol ;
109
+ }
110
+
102
111
var socketUrl = url . format ( {
103
- protocol : ( window . location . protocol === "https:" || urlParts . hostname === '0.0.0.0' ) ? window . location . protocol : urlParts . protocol ,
112
+ protocol : protocol ,
104
113
auth : urlParts . auth ,
105
114
hostname : hostname ,
106
115
port : ( urlParts . port === '0' ) ? window . location . port : urlParts . port ,
Original file line number Diff line number Diff line change 1
1
# Modus: manual script
2
2
3
3
``` shell
4
- node ../../bin/webpack-dev-server.js --open
4
+ node ../../bin/webpack-dev-server.js --open --no-inline
5
5
```
6
6
7
7
The webpack-dev-server client is added as script tag to the html page.
8
8
9
9
``` shell
10
- node ../../bin/webpack-dev-server.js --open --https
10
+ node ../../bin/webpack-dev-server.js --open --no-inline -- https
11
11
```
12
12
13
13
This will do the same, but connect over https.
You can’t perform that action at this time.
0 commit comments