8000 Preloaded JS file triggers warning: "was preloaded but not used within a few seconds" in Laravel app using Vite · Issue #55793 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content
Preloaded JS file triggers warning: "was preloaded but not used within a few seconds" in Laravel app using Vite #55793
@midsonlajeanty

Description

@midsonlajeanty

Laravel Version

12.15.X

PHP Version

8.4

Database Driver & Version

Sqlite

Description

In my Larave 10.4.1 application using Vite for asset bundling, I'm getting the following browser warning in the console when i use aggresive prefetching:

The resource https:/<...>/app-l0sNRNKZ.js was preloaded using link preload but not used within a few seconds from the window's load event.
Please make sure it has an appropriate `as` value and it is preloaded intentionally.
This happens even though the app.js file is included with the `@vite('resources/js/app.js')` directive in my Blade layout, and the generated preload link uses `rel="modulepreload"`.

It appears that the asset is preloaded correctly, but the browser considers it unused shortly after load, possibly due to how Vite or Laravel delays its usage via dynamic import or defer.

Steps To Reproduce

Any laravel project

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0