Webpack-dev-server: Get mime type "application/octet-stream" for wasm files

Created on 20 Nov 2018  路  11Comments  路  Source: webpack/webpack-dev-server

  • Operating System: ArchLinux
  • Node Version: v11.0.0
  • NPM Version: 6..4.1
  • webpack Version: 4.26.0
  • webpack-dev-server Version: 3.1.10

  • [x] This is a bug

  • [ ] This is a modification request

Code

  // webpack.config.js
  ...
  devServer: {
    contentBase: path.join(__dirname, 'build/bundle'),
    watchContentBase: true,
  }
  ...

Expected Behavior

.wasm files should have "application/wasm" content type.

Actual Behavior

Got "application/octet-stream"

For Bugs; How can we reproduce the behavior?

The files generate by webpack work fine. The issue only happen with the static files in contentBase folder.

More information:

mime version: 1.6.0
mime-types version: 2.1.21
Both two package return "application/wasm" when lookup .wasm files.

3 (important) patch 3 (broken) bug

All 11 comments

@samsam2310 can't reproduce, please create minimum reproducible test repo

Hi @evilebottnawi

Here is the test repo: https://github.com/samsam2310/wp-bug
I have tried this and got the same result, hope this will help.

Thanks

Hi @evilebottnawi
It seems like package "send" use a old version of node mime package, therefore, the .wasm file has wrong mime type.
There is a PR which have been merged since one month ago, so the issue should be fixed after next update.

https://github.com/pillarjs/send/pull/154

@samsam2310 feel free to send a PR with fix

Hi @evilebottnawi
The "send" package is used by express.js, so I think there is no need to add a new pr.
But we need to wait for the next release of express.js.

@samsam2310 Do you have link on express.js issue?

@evilebottnawi You can take a look about the PR I posted above : https://github.com/pillarjs/send/pull/154

It seems like it should be released with [email protected], but it didn't.
And this issue https://github.com/expressjs/express/issues/3589 says it will be released with [email protected], but 4.17 disappeared and it seems like the next release will be 5.0.0 (There is a new release 5.0.0-alpha).
So, ... I don't know....
If this is important, maybe we could add express.static.mime.types["wasm"] = "application/wasm"; until the next release of express.

@samsam2310 strange, Yes, it will be in the 4.17 release +1 should be solve :confused: Can you send a PR with test, maybe we need update deps

@evilebottnawi
I don't think this can fixed, or, for now it can't.
It seems like there isn't [email protected], the latest release is 4.16.4.
And the issue is caused by [email protected] (bind with express.js) which lock mime to @1.4.1, and the latest release of send is released on Feb 8, 2018.

@samsam2310 hm, here PR https://github.com/expressjs/express/pull/3778/files, maybe we need workaround before this will be released

@evilebottnawi ok, I can make a PR with a workaround solution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mrdulin picture mrdulin  路  3Comments

wojtekmaj picture wojtekmaj  路  3Comments

daryn-k picture daryn-k  路  3Comments

tulika21-zz picture tulika21-zz  路  3Comments

antoinerousseau picture antoinerousseau  路  3Comments