[英]Browser-sync proxy not loading with Laravel
我在我的 Laravel 8 项目中使用 browser-sync (v 2.27.9) 和 browser-sync-webpack-plugin (v 2.3.0)。 在我使用 MacOS Monterey (v12.3) 在全新的 Mac Studio 上克隆我的项目之前,我的设置从未遇到任何问题。 到目前为止,Browser-sync 一直代理 localhost:8000 并在 localhost:3000 上正常加载。
localhost:8000 加载正常,只是浏览器同步代理没有加载。 浏览器同步 UI 在端口 3001 上也可以正常加载。 I have tried re-installing both npm packages, restarting my computer, killing all ports, starting and re-starting the php development server, running npm run watch over and over, checking in multiple browsers, and trying 127.0.0.1 instead of "localhost ”。
这是我的 webpack.mix.js 设置,这些设置在过去一直有效:
.browserSync({
proxy: 'http://localhost:8000/',
files: [
'app/**/*',
'public/**/*',
'resources/views/**/*',
'resources/js/**/*' ,
'resources/js/**/*/*',
'resources/lang/**/*',
'routes/**/*',
],
})
我在 localhost:3000 的浏览器中看到了一个永久的旋转图标。 在开发人员工具的网络选项卡中,它说 localhost 的状态为(待定)。
在浏览器同步帮助页面中,它说“99% 的时间,这是因为您的 web 页面没有正文标签”。 我已经确认我的网站有一个 body 标签,所以这个问题必须属于 1% 的类别。
弄清楚了。 我需要在代理 URL 中将“localhost”更改为 127.0.0.1。 仍然不清楚为什么 localhost 过去有效但现在无效。
.browserSync({
proxy: 'http://127.0.0.1:8000/',
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.