gpt4 book ai didi

javascript - [WDS] 不断断开!错误,ReactJs,Webpack

转载 作者:行者123 更新时间:2023-12-03 13:54:50 25 4
gpt4 key购买 nike

enter image description here

此问题与帖子相关:Keep getting [WDS] Disconnected! error

我已经根据答案更新了我的 webpack 配置设置,但是控制台中仍然出现“[WDS] Disconnected!错误”。

请问有什么建议吗?

webpack.config.js

var webpack = require("webpack");
var path = require("path");


module.exports = {

devtool: "inline-source-map",
entry: [
"webpack-dev-server/client?http://127.0.0.0:8080/",
"webpack/hot/only-dev-server",
"./src"
],
devServer: {
contentBase: "./public",
hot: true,
inline: true,
quiet: false,
noInfo: true,
stats: { colors: true }
},
output: {
path: path.join(__dirname, "./public"),
filename: "./assets/js/bundle.js"
},
resolve: {
modulesDirectrories: ["node_modules", "src"],
extentions: ["", ".js"]
},
module : {
loaders: [
{
test: /\.jsx?$/,
exclude: "/node_modules/",
loaders: ["react-hot-loader", "babel?presets[]=react,presets[]=es2015"]
},
{
test: /\.css$/,
loader: "style-loader!css-loader"
},
{
test: /\.gif$/,
loader: "url-loader?mimetype=image/png"
},
{
test: /\.woff(2)?(\?v=[0-9].[0-9].[0-9])?$/,
loader: "url-loader?mimetype=application/font-woff"
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9].[0-9].[0-9])?$/,
loader: "file-loader?name=[name].[ext]"
}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("development")
}
})
]}

最佳答案

将 TransportMode 更改为 ws 而不是“sock-js.node”:-

devServer: {
transportMode: 'ws',
injectClient: false,
}

关于javascript - [WDS] 不断断开!错误,ReactJs,Webpack,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39291796/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com