Skip to content

Commit 9073cd9

Browse files
committed
fix(Server): validate express.static.mime.types
fixes: #1724
1 parent d5d60cb commit 9073cd9

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/Server.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ class Server {
8989
if (options.lazy && !options.filename) {
9090
throw new Error("'filename' option must be set in lazy mode.");
9191
}
92-
92+
9393
// if the user enables http2, we can safely enable https
9494
if (options.http2 && !options.https) {
9595
options.https = true;
9696
}
97-
97+
9898
updateCompiler(compiler, options);
9999

100100
this.stats =
@@ -174,7 +174,14 @@ class Server {
174174

175175
// ref: https://github.com/webpack/webpack-dev-server/issues/1575
176176
// remove this when send@^0.16.3
177-
express.static.mime.types.wasm = 'application/wasm';
177+
if (
178+
express.static &&
179+
express.static.mime &&
180+
express.static.mime.types &&
181+
!express.static.mime.types.wasm
182+
) {
183+
express.static.mime.types.wasm = 'application/wasm';
184+
}
178185

179186
app.all('*', (req, res, next) => {
180187
if (this.checkHost(req.headers)) {

0 commit comments

Comments
 (0)