From 52670b6a99ffc158cb590c8dd871f3157f0b0518 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Louvradoux?= Date: Thu, 8 Oct 2020 09:38:41 +0200 Subject: [PATCH] Allow entrypoints.json to be hosted remotely --- src/Asset/EntrypointLookup.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Asset/EntrypointLookup.php b/src/Asset/EntrypointLookup.php index d1ff9f24..ab84a413 100644 --- a/src/Asset/EntrypointLookup.php +++ b/src/Asset/EntrypointLookup.php @@ -117,14 +117,15 @@ private function getEntriesData(): array } } - if (!file_exists($this->entrypointJsonPath)) { + $entrypointJsonContents = file_get_contents($this->entrypointJsonPath); + if ($entrypointJsonContents === false) { if (!$this->strictMode) { return []; } - throw new \InvalidArgumentException(sprintf('Could not find the entrypoints file from Webpack: the file "%s" does not exist.', $this->entrypointJsonPath)); + throw new \InvalidArgumentException(sprintf('Could not find the entrypoints file from Webpack: the file "%s" does not exist or it is not readable.', $this->entrypointJsonPath)); } - $this->entriesData = json_decode(file_get_contents($this->entrypointJsonPath), true); + $this->entriesData = json_decode($entrypointJsonContents, true); if (null === $this->entriesData) { throw new \InvalidArgumentException(sprintf('There was a problem JSON decoding the "%s" file', $this->entrypointJsonPath));