Skip to content

Option to disable serveIndex middleware #1745

Description

@jamesknelson
  • Operating System: Mac OS 10.14.3
  • Node Version: 11.1.0
  • NPM Version: 6.7.0
  • webpack Version: 4.29.6
  • webpack-dev-server Version: 3.2.1
  • This is a bug
  • This is a modification request

Code

It'd be useful to be able to disable the express serve-index middleware, which generates directory listings when you view a directory that doesn't have an index.html file.

// webpack.config.js
module.exports = {
  // ...
  devServer: {
    serveIndex: false,
  }
}

For Features; What is the motivation and/or use-case for the feature?

This option is required to be able to do SSR for the root page with webpack-dev-server in an after() middleware using the serverSideRender option, as otherwise an automatically-generated index page will be shown instead.

I'd be happy to put a PR together for this change if it's likely to be accepted.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions