Skip to content

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

Closed

Description

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

Activity

  1. alexander-akait commented on Nov 20, 2018

    @alexander-akait
    Member

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

  2. samsam2310 commented on Nov 21, 2018

    @samsam2310
    ContributorAuthor

    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

  3. samsam2310 commented on Nov 26, 2018

    @samsam2310
    ContributorAuthor

    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

  4. alexander-akait commented on Nov 26, 2018

    @alexander-akait
    Member

    @samsam2310 feel free to send a PR with fix

  5. samsam2310 commented on Nov 27, 2018

    @samsam2310
    ContributorAuthor

    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.

  6. alexander-akait commented on Nov 27, 2018

    @alexander-akait
    Member

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

  7. samsam2310 commented on Nov 27, 2018

    @samsam2310
    ContributorAuthor

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

  8. alexander-akait commented on Nov 27, 2018

    @alexander-akait
    Member

    @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

  9. samsam2310 commented on Nov 27, 2018

    @samsam2310
    ContributorAuthor

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

  10. alexander-akait commented on Nov 27, 2018

    @alexander-akait
    Member

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

  11. samsam2310 commented on Nov 27, 2018

    @samsam2310
    ContributorAuthor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions