fix(Server): mime type for wasm in contentBase directory (#1575) (#1580) · webpack/webpack-dev-server@fadae5d

File tree

3 files changed

lines changed

    • fixtures/contentbase-config/public

3 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -132,6 +132,10 @@ function Server (compiler, options = {}, _log) {

132132

// eslint-disable-next-line

133133

const app = this.app = new express();

134134
135+

// ref: https://github.com/webpack/webpack-dev-server/issues/1575

136+

// remove this when send@^0.16.3

137+

express.static.mime.types.wasm = 'application/wasm';

138+
135139

app.all('*', (req, res, next) => {

136140

if (this.checkHost(req.headers)) {

137141

return next();

Original file line numberDiff line numberDiff line change

@@ -121,4 +121,18 @@ describe('ContentBase', () => {

121121

.expect(404, done);

122122

});

123123

});

124+
125+

describe('Content type', () => {

126+

before((done) => {

127+

server = helper.start(config, {

128+

contentBase: [contentBasePublic]

129+

}, done);

130+

req = request(server.app);

131+

});

132+
133+

it('Request foo.wasm', (done) => {

134+

req.get('/foo.wasm')

135+

.expect('Content-Type', 'application/wasm', done);

136+

});

137+

});

124138

});