You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: nativescript.webpack.js
+96-9Lines changed: 96 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,106 @@
1
-
constspawn=require('cross-spawn');
2
1
const{ VueLoaderPlugin }=require('vue-loader');
2
+
constspawn=require('cross-spawn');
3
+
4
+
functionfindFreePort(startingPort=8098){
5
+
letfound=false;
6
+
letport=startingPort;
7
+
8
+
constisPortFree=(port)=>
9
+
newPromise((resolve)=>{
10
+
constserver=require('http')
11
+
.createServer()
12
+
.listen(port,'0.0.0.0',()=>{
13
+
server.close();
14
+
resolve(true);
15
+
})
16
+
.on('error',()=>{
17
+
resolve(false);
18
+
});
19
+
});
20
+
21
+
constfindFreePort=()=>{
22
+
isPortFree(port).then((isFree)=>{
23
+
if(!isFree){
24
+
port++;
25
+
returnfindFreePort();
26
+
}
27
+
found=true;
28
+
});
29
+
};
30
+
31
+
findFreePort();
32
+
33
+
while(!found){
34
+
process._tickCallback();
35
+
conststart=Date.now();
36
+
while(Date.now()-start<100){
37
+
// busy wait... not ideal, but we need to find a port synchronously...
38
+
}
39
+
}
40
+
41
+
returnport;
42
+
}
43
+
44
+
functionstartVueDevtools(port,isAndroid=false){
45
+
console.log(`[VueDevtools] Starting standalone Vue Devtools on port ${port}`);
46
+
if(isAndroid){
47
+
console.log(
48
+
`[VueDevtools] If the app doesn't automatically connect, check if http traffic is allowed. (e.g. on Android, you may need to set android:usesCleartextTraffic="true" in AndroidManifest.xml)`
0 commit comments