Problem/Motivation

Vite 5 changes the default location of generated manifest.json file. From `dist/manifest.json` to `dist/.vite/manifest.json`. https://github.com/vitejs/vite/pull/14230
Currently, when loading the manifest.json if the manifest path is not explicitly configured, a default value of `dist/manifest.json` is used. This will need to change for Vite 5.

Proposed resolution

Instead of statically using default path `dist/manifest.json`, check if `dist/manifest.json` file exists if so use it as a default value, if not use `dist/.vite/manifest.json`. This will add support for Vite 5 while providing backward compatibility with Vite 4.

Issue fork vite-3401054

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

wotnak created an issue. See original summary.

darvanen’s picture

Also this line 165 in AssetLibrary.php now fails because vite returns a 200 instead of 404:

return $this->httpClient->request('GET', $this->getDevServerBaseUrl(), ['http_errors' => FALSE])->getStatusCode() === 404;

darvanen’s picture

Status: Active » Needs review

I note the manifest.json location work is already in 1.x-dev so I think this is all that's left for Vite 5 compatibility?

wotnak’s picture

Status: Needs review » Needs work

Change looks good. The only thing to fix is one issue reported by phpstan (you can see it in the merge request ui).
The in_array function should be called with the third parameter set to true to strictly compare values, including checking their types. https://www.php.net/manual/en/function.in-array.php#refsect1-function.in...

ankithashetty made their first commit to this issue’s fork.

  • wotnak committed 32a394ed on 1.x authored by darvanen
    Issue #3401054 by darvanen, ankithashetty: Vite 5 compatibility
    
wotnak’s picture

Status: Needs work » Fixed
wotnak’s picture

Available in the 1.1.1 release.

darvanen’s picture

Many thanks for tidying that up and the swift release :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.