Skip to content

Commit

Permalink
Drop static-serve, add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
TrySound committed Dec 1, 2020
1 parent ab9f23d commit 0f70814
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 27 deletions.
53 changes: 37 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"gzip-size": "^6.0.0",
"lodash": "^4.17.20",
"opener": "^1.5.2",
"serve-static": "^1.14.1",
"sirv": "^1.0.7",
"ws": "^7.3.1"
},
Expand Down
12 changes: 2 additions & 10 deletions src/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ async function startServer(bundleStats, opts) {
if (!chartData) return;

const sirvMiddleware = sirv(`${projectRoot}/public`, {
// disables caching and traverse the file system on every request
dev: true
});

Expand All @@ -64,16 +65,7 @@ async function startServer(bundleStats, opts) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end(html);
} else {
sirvMiddleware(req, res, err => {
if (err) {
console.error(err.stack || err.toString());
res.writeHead(500);
res.end();
} else {
res.writeHead(404);
res.end();
}
});
sirvMiddleware(req, res);
}
});

Expand Down

0 comments on commit 0f70814

Please sign in to comment.