Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Get mime type "application/octet-stream" for wasm files #1575

Closed
1 of 2 tasks
samsam2310 opened this issue Nov 20, 2018 · 11 comments · Fixed by #1580
Closed
1 of 2 tasks

Get mime type "application/octet-stream" for wasm files #1575

samsam2310 opened this issue Nov 20, 2018 · 11 comments · Fixed by #1580

Comments

@samsam2310
Copy link
Contributor

  • 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
  • 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.

@alexander-akait
Copy link
Member

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

@samsam2310
Copy link
Contributor Author

samsam2310 commented Nov 21, 2018

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

@samsam2310
Copy link
Contributor Author

samsam2310 commented Nov 26, 2018

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.

pillarjs/send#154

@alexander-akait
Copy link
Member

@samsam2310 feel free to send a PR with fix

@samsam2310
Copy link
Contributor Author

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.

@alexander-akait
Copy link
Member

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

@samsam2310
Copy link
Contributor Author

samsam2310 commented Nov 27, 2018

@evilebottnawi You can take a look about the PR I posted above : pillarjs/send#154

It seems like it should be released with send@0.16.2, but it didn't.
And this issue expressjs/express#3589 says it will be released with express@4.17, 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.

@alexander-akait
Copy link
Member

alexander-akait commented Nov 27, 2018

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

@samsam2310
Copy link
Contributor Author

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

@alexander-akait
Copy link
Member

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

@samsam2310
Copy link
Contributor Author

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

samsam2310 added a commit to samsam2310/webpack-dev-server that referenced this issue Nov 27, 2018
samsam2310 added a commit to samsam2310/webpack-dev-server that referenced this issue Nov 27, 2018
samsam2310 added a commit to samsam2310/webpack-dev-server that referenced this issue Nov 27, 2018
This was referenced Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants