diff --git a/lib/Server.js b/lib/Server.js index df60ccff74..0030fa560d 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -132,6 +132,10 @@ function Server (compiler, options = {}, _log) { // eslint-disable-next-line const app = this.app = new express(); + // ref: https://github.com/webpack/webpack-dev-server/issues/1575 + // remove this when send@^0.16.3 + express.static.mime.types.wasm = 'application/wasm'; + app.all('*', (req, res, next) => { if (this.checkHost(req.headers)) { return next(); diff --git a/test/ContentBase.test.js b/test/ContentBase.test.js index c2d105f50e..bcd98a7acd 100644 --- a/test/ContentBase.test.js +++ b/test/ContentBase.test.js @@ -121,4 +121,18 @@ describe('ContentBase', () => { .expect(404, done); }); }); + + describe('Content type', () => { + before((done) => { + server = helper.start(config, { + contentBase: [contentBasePublic] + }, done); + req = request(server.app); + }); + + it('Request foo.wasm', (done) => { + req.get('/foo.wasm') + .expect('Content-Type', 'application/wasm', done); + }); + }); }); diff --git a/test/fixtures/contentbase-config/public/foo.wasm b/test/fixtures/contentbase-config/public/foo.wasm new file mode 100644 index 0000000000..e69de29bb2