Skip to content

Commit 18d0bf3

Browse files
committed
create server & open browser after the first bundle
1 parent d8161fb commit 18d0bf3

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

devtools/test_dashboard/server.js

+24-18
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,6 @@ var mathjax3chtml = args.mathjax3chtml;
2020

2121
if(strict) config.entry = './lib/index-strict.js';
2222

23-
// Create server
24-
var server = http.createServer(ecstatic({
25-
root: constants.pathToRoot,
26-
cache: 0,
27-
gzip: true,
28-
cors: true
29-
}));
30-
31-
// Start the server up!
32-
server.listen(PORT);
33-
34-
// open up browser window
35-
open('http://localhost:' + PORT + '/devtools/test_dashboard/index' + (
36-
strict ? '-strict' :
37-
mathjax3 ? '-mathjax3' :
38-
mathjax3chtml ? '-mathjax3chtml' : ''
39-
) + '.html');
40-
4123
// mock list
4224
getMockFiles()
4325
.then(readFiles)
@@ -79,6 +61,8 @@ compiler.run(function(devtoolsErr, devtoolsStats) {
7961

8062
compiler.close(function(closeErr) {
8163
if(!closeErr) {
64+
var firstBundle = true;
65+
8266
compiler = webpack(config);
8367
compiler.watch({}, function(err, stats) {
8468
if(err) {
@@ -87,6 +71,28 @@ compiler.run(function(devtoolsErr, devtoolsStats) {
8771
console.log('stats.errors:', stats.errors);
8872
} else {
8973
console.log('success:', config.output.path + '/' + config.output.filename);
74+
75+
if(firstBundle) {
76+
// Create server
77+
var server = http.createServer(ecstatic({
78+
root: constants.pathToRoot,
79+
cache: 0,
80+
gzip: true,
81+
cors: true
82+
}));
83+
84+
// Start the server up!
85+
server.listen(PORT);
86+
87+
// open up browser window
88+
open('http://localhost:' + PORT + '/devtools/test_dashboard/index' + (
89+
strict ? '-strict' :
90+
mathjax3 ? '-mathjax3' :
91+
mathjax3chtml ? '-mathjax3chtml' : ''
92+
) + '.html');
93+
94+
firstBundle = false;
95+
}
9096
}
9197
});
9298
}

0 commit comments

Comments
 (0)