Laravel混合热重载和域名 [英] Laravel mix hot reload and domain name
问题描述
我在开发环境中使用Laravel Homestead,因此可以在 http://test.app <上访问我的网站/p>
现在,我尝试将laravel mix配置为与VUEJS一起使用.为此,我在一个模板中包含一个JS文件:
<script src="{{ url(mix('js/main.js'))}}"></script>
结果是
<script src="//localhost:8080/js/main.js"></script>
似乎这样,localhost:8080被硬编码在vendor/laravel/framework/src/Illuminate/Foundation/helper.php中(请参阅解决方案
您引用的源将仅在监视模式下执行.
在这种情况下,Laravel在8080端口上为所有静态文件(css,js)混合托管一台服务器,因此您可以获得热重载功能,而php文件仍在Homestead Niginx上运行,而我不这样做.看不出有什么问题.
它将在生产模式下编译为您的APP_URL,如果8080与您的其他服务有某种冲突,则可以修改Laravel Mix的配置文件.
I use Laravel Homestead for my development environment, so my website is accessible on http://test.app
Now I tried to configure laravel mix to use it with VUEJS. For this, I include a JS file in one of my templates:
<script src="{{ url(mix('js/main.js'))}}"></script>
The result of this is
<script src="//localhost:8080/js/main.js"></script>
It seems so, that the localhost:8080 is hardcoded in vendor/laravel/framework/src/Illuminate/Foundation/helper.php (see https://github.com/laravel/framework/blob/e35a60f7f3ef1d75754522771f13762b3058f1b0/src/Illuminate/Foundation/helpers.php#L560)
How to fix this or how I done something wrong?
the source you quote will only be executed in watch mode.
In this case, Laravel mix host a server on 8080 port for all your static files (css, js) so you can get the hot-reload feature, while the php files still running on your Homestead Niginx, and I don't see anything wrong with it.
it will compile to your APP_URL in production mode and if 8080 is somehow conflicting with your other service you can modify config file of Laravel Mix.
这篇关于Laravel混合热重载和域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!