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));