Skip to content

Commit fadae5d

Browse files
samsam2310evilebottnawi
authored andcommitted
fix(Server): mime type for wasm in contentBase directory (#1575) (#1580)
1 parent 7a3a257 commit fadae5d

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

lib/Server.js

Lines changed: 4 additions & 0 deletions
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();

test/ContentBase.test.js

Lines changed: 14 additions & 0 deletions
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
});

test/fixtures/contentbase-config/public/foo.wasm

Whitespace-only changes.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy