Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(Server): Workaround for .wasm file mime type (#1575) #1580

Merged
merged 3 commits into from
Dec 5, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
14 changes: 14 additions & 0 deletions test/ContentBase.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});
Empty file.