Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manifest.json cause 404 error if file in resources is missing #1416

Closed
nathanaelytj opened this issue Apr 17, 2024 · 5 comments · Fixed by #1421
Closed

Manifest.json cause 404 error if file in resources is missing #1416

nathanaelytj opened this issue Apr 17, 2024 · 5 comments · Fixed by #1421

Comments

@nathanaelytj
Copy link

nathanaelytj commented Apr 17, 2024

Horizon Version

5.24.1

Laravel Version

11.4.0

PHP Version

8.3.4

Redis Driver

PhpRedis

Redis Version

7.2.4

Database Driver & Version

No response

Description

This update cause a bug when opening horizon dashboard with error like:
GET http://localhost:5173/resources/js/app.js net::ERR_ABORTED 404 (Not Found)
GET http://localhost:5173/resources/sass/styles.scss net::ERR_ABORTED 404 (Not Found)

This is because in some of our project we don't use js anymore but ts files also we don't use styles.scss as entrypoint anymore but another file. This issue will also break any project without those files as entrypoint.

After reading commit history, this file seems to be the culprit: public/build/manifest.json

Steps To Reproduce

  1. Create new laravel project
  2. Install horizon
  3. Remove or rename file resources/js/app.js and resources/sass/styles.scss
  4. Open horizon dashboard and this issue will happen
@driesvints
Copy link
Member

Did you publish the new assets like: https://github.com/laravel/laravel/blob/11.x/composer.json#L39

php artisan vendor:publish --tag=laravel-assets --ansi --force

@driesvints
Copy link
Member

@mmachatschek Should we possible use a different name for the manifest file? Like horizon-manifest? #1415

@bramdevries
Copy link

We also updated to the latest Horizon version (5.24.1) and this only seems to be an issue on local environments when running npm run dev since #1413. I have a bit more info from debugging:

The issue seems to be that when you run npm run dev it will use a different path (from the application's vite.config.js) and attempt to resolve the Horizon dependencies from the resources directory instead of vendor/horizon. If you don't run npm run dev then the assets will load correctly again.

While the layout loading the assets with Vite:asset() correctly passes the build directory, this is ignored when running in "hot" mode (which is what npm run dev does).

@driesvints
Copy link
Member

Reverted everything for now. Thanks all for reporting.

@mmachatschek
Copy link
Contributor

thanks @bramdevries thanks for the debugging info. Will check that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants