Run the webpack-dev-server page and report an error cannot get /

problem description: the project runs the npm start browser and always reports cannot get /, and there is no problem with the webpack packaging process.

webpack.config.js

const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");

let getHtmlConfig = function (name, title) {
    return {
        template: "./demos/" + name + ".html",
        filename: "demos/" + name + ".html",
        title: title,
        inject: true | "body",
        hash: true,
        cache: true,
        chunks: ["common", name]
    };
};

module.exports = {

    entry: {
        "a" : "./js/a.js",
        "b" : "./js/b.js",
        "c" : "./js/c.js"
    },

     output: {
        path: path.resolve(__dirname, "dist"),
        filename: "js/[name].min.js",
    },

    module: {
        loaders: [{
                test: /\.js$/,
                exclude: /node_modules/,
                loader: "babel-loader"
            }, 
            {
                test: /\.css$/,
                use: ["css-loader"]
            },
            {
                test: /\.(png|jpg|gif|jpeg)$/,
                loader: "url-loader",
                options: {
                    limit: 2048,
                    name: "images/[name].[ext]",
                    publicPath:"../"
                }
            },
            {
                test: /\.(eot|svg|ttf|woff|woff2|otf)$/,
                loader: "url-loader",
                options: {
                    limit: 8192,
                    name: "fonts/[name].[ext]"
                }
            }
        ]
    },

    plugins: [
        new HtmlWebpackPlugin(getHtmlConfig("a", "a")),
        new HtmlWebpackPlugin(getHtmlConfig("b", "b")),
        new HtmlWebpackPlugin(getHtmlConfig("c", "c")),
        new ExtractTextPlugin("css/[name].min.css")
    ],

    devServer: {
        host: "0.0.0.0",
        useLocalIp: true,
        contentBase:path.resolve(__dirname, "dist"),
        compress: true,
        port: 9000,
        open: true,
    }
};

package.json

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "watch": "webpack --watch",
    "start": "webpack-dev-server --open",
    "build": "webpack --env.production"
  },

this doesn't seem to be a problem. Because you are a multi-page application, the index.html that the browser opens by default does not exist. You can try http://localhost:9000/demos/a.html-sharp/ whether your home page can visit

.
Menu