From c27a498fae55f70a73e242a7dd1cff39012ba404 Mon Sep 17 00:00:00 2001 From: Carlos Gonzales Date: Thu, 23 Feb 2017 12:38:21 -0600 Subject: [PATCH] while doing `npm run hot`, do not require existence of the manifest file --- src/Illuminate/Foundation/helpers.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Illuminate/Foundation/helpers.php b/src/Illuminate/Foundation/helpers.php index 57b50e1c546e..c111e0db51ce 100644 --- a/src/Illuminate/Foundation/helpers.php +++ b/src/Illuminate/Foundation/helpers.php @@ -562,10 +562,18 @@ function mix($path, $manifestDirectory = '') { static $manifest; + if (! starts_with($path, '/')) { + $path = "/{$path}"; + } + if ($manifestDirectory && ! starts_with($manifestDirectory, '/')) { $manifestDirectory = "/{$manifestDirectory}"; } + if (file_exists(public_path($manifestDirectory.'/hot'))) { + return new HtmlString("http://localhost:8080{$path}"); + } + if (! $manifest) { if (! file_exists($manifestPath = public_path($manifestDirectory.'/mix-manifest.json'))) { throw new Exception('The Mix manifest does not exist.'); @@ -574,10 +582,6 @@ function mix($path, $manifestDirectory = '') $manifest = json_decode(file_get_contents($manifestPath), true); } - if (! starts_with($path, '/')) { - $path = "/{$path}"; - } - if (! array_key_exists($path, $manifest)) { throw new Exception( "Unable to locate Mix file: {$path}. Please check your ". @@ -585,9 +589,7 @@ function mix($path, $manifestDirectory = '') ); } - return file_exists(public_path($manifestDirectory.'/hot')) - ? new HtmlString("http://localhost:8080{$manifest[$path]}") - : new HtmlString($manifestDirectory.$manifest[$path]); + return new HtmlString($manifestDirectory.$manifest[$path]); } }