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

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

‎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
constapp=this.app=newexpress();
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
returnnext();

‎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)