在Firefox和Safari上的vuejs spa中,我在控制台中收到以下消息 当我重新加载页面(或提交带有后期操作的表单)
页面加载时,与https://localhost:5000/dist/__ webpack_hmr的连接中断。
我将netcore 2.1用作服务器端
我的依赖是
"devDependencies": {
"aspnet-webpack": "^2.0.1",
"css-loader": "^0.25.0",
"event-source-polyfill": "^0.0.7",
"extract-text-webpack-plugin": "^2.0.0-rc",
"file-loader": "^0.9.0",
"node-sass": "^4.11.0",
"sass-loader": "^6.0.6",
"style-loader": "^0.13.1",
"uglifyjs-webpack-plugin": "^1.2.5",
"url-loader": "^0.5.7",
"vue": "^2.2.2",
"vue-loader": "^11.1.4",
"vue-router": "^2.3.0",
"vue-template-compiler": "^2.2.2",
"webpack": "^2.2.0",
"webpack-hot-middleware": "^2.12.2"
},
"dependencies": {
"@deveodk/vue-toastr": "^1.0.4",
"axios": "^0.18.0",
"bootstrap-vue": "^2.0.0-rc.1",
"lodash": "^4.17.11",
"nprogress": "^0.2.0",
"vee-validate": "^2.2.0",
"velocity-animate": "^1.5.2",
"vue-slider-component": "^2.8.12",
"vuex": "^3.1.0"
}
在我启动时我设置了
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
{
HotModuleReplacement = true
,HotModuleReplacementEndpoint = "/__webpack_hmr"
});
}
我快疯了,不明白为什么?似乎只能在chrome中有效
答案 0 :(得分:0)
似乎从dist文件夹请求__webpack_hmr
,请在启动时尝试使用以下代码:
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
HotModuleReplacement = true,
HotModuleReplacementEndpoint = "/dist/__webpack_hmr"
});