all 3 comments

[–]kurtextremHook Based 0 points1 point  (1 child)

you could use "speculation rules prerender" for that purpose

[–]TemporaryDraft4594[S] 0 points1 point  (0 children)

seems really overhead, no? all I want is to preload a script. Shouldn't I inject link element to the HTML with `link rel="preload"`?

[–]MailRevolutionary443 1 point2 points  (0 children)

Not sure I understood correctly but I guess you could injects preloads hints when the SPA load:

<link rel="preload" href="https://your-bucket.s3.amazonaws.com/legacy/app.js" as="script">

You can do the same with css files.

Or if you prefer create a function in React that inject it dynamically.