无法在子域 Laravel 安装上找到 Mix 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45351117/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unable to locate Mix file on a subdomain Laravel instalattion
提问by marcelo2605
I'm using Laravel on a subdomain. All Laravel files, except public folder, are in a folder in the same level of public_html folder.
我在子域上使用 Laravel。所有 Laravel 文件,除了 public 文件夹,都在 public_html 文件夹的同级文件夹中。
The public folder files are inside subdomain folder, inside public_html folder.
公共文件夹文件位于子域文件夹中,在 public_html 文件夹中。
I changed path of autoload.php and app.php, inside my_subdomain/index.php.
我在 my_subdomain/index.php 中更改了 autoload.php 和 app.php 的路径。
Everything is running fine. But I need to enable mix version and now Laravel show this error:
一切正常。但我需要启用混合版本,现在 Laravel 显示此错误:
Unable to locate Mix file: /js/app.js. Please check your webpack.mix.js output paths and try again.
无法找到 Mix 文件:/js/app.js。请检查您的 webpack.mix.js 输出路径并重试。
The mix-manifest.json file is inside the my_subdomain folder:
mix-manifest.json 文件位于 my_subdomain 文件夹中:
{
"/js/app.js": "js/app.edb30a0318d87750bd69.js",
"/css/app.css": "css/app.2e8af0500b8b83e4423e.css"
}
回答by Rainer Flessner
Hey simply use the asset()
function to use in
嘿简单地使用asset()
函数来使用
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
and with the mix development this schoul help
和混合开发这个学校帮助
回答by Дмитрий Алфёров
Your index.php must content bind path for public directory
您的 index.php 必须包含公共目录的内容绑定路径
$app->bind('path.public', function () {
return __DIR__;
});