为什么 webpack 一直断开并尝试重新连接?

问题描述 投票:0回答:0

enter image description here我的 webpack-dev-server 保持断开连接并尝试重新连接,但实际上没有连接。这里附上一张我的 chrome 控制台图片

这是我的 webpack config.js[在此处输入图片描述][2]

````
const path = require("path");
const fs = require("fs");
const webpack = require("webpack")
const HtmlWebpackPlugin = require("html-webpack-plugin");
const appDirectory = fs.realpathSync(process.cwd());

module.exports = { 
entry:[
    "webpack-dev-server/client?http://192.0.0.0:8080",
    "webpack/hot/only-dev-server",
    path.resolve(appDirectory, "src/app.ts"), // path to the main .ts file
],
output: {
    path: path.join(__dirname, 'dist'),
    filename: "[name].js", //Name for the javascript file that is created/compiled in memory
    clean: true,
    sourceMapFilename: "[name].js.map"
},
devtool: "eval-cheap-source-map",
resolve: {
    extensions: [".tsx", ".ts", ".js"],
},
devServer: {
    client: {
        webSocketTransport: 'ws',
        reconnect: true,
        overlay: true,
        progress: true,
    },
    allowedHosts: 'all',
    // host: "0.0.0.0",
    port: 8080, //port that we're using for local host (localhost: 8080)
    static: path.resolve(appDirectory, "public"), //tells webpack to serve from the public folder
    hot: true,
    liveReload: true,
    devMiddleware: {
        publicPath: "/",
    }
},
module: {
rules: [
    {
        test: /\.tsx?$/,
        enforce: "pre",
        use: "ts-loader",
        exclude: /node_modules/,
    },
],
},
plugins: [
    // new webpack.HotModuleReplacementPlugin(),
    new HtmlWebpackPlugin({
        inject: true,
        template: path.resolve(appDirectory, "public/index.html"),
    })
],
mode: "development"
}; ````

我尝试更改入口点、主机和 deServer webpack-dev-server 仍然没有连接,请问我还能做什么?

javascript typescript webpack-dev-server babylonjs
© www.soinside.com 2019 - 2024. All rights reserved.