PhoenixAssets.EarlyHints (PhoenixAssets v0.1.0)

View Source

An opt-in plug that sends HTTP 103 Early Hints for a Vite entry's assets.

Early Hints let browsers start fetching the entry's stylesheets and module chunks while Phoenix is still rendering the response. Mount it in the pipeline that renders the HTML shell:

pipeline :browser do
  # ...
  plug PhoenixAssets.EarlyHints, entry: "src/app.ts"
end

Emits only when a production manifest is loaded and the adapter supports informational responses (Plug.Conn.inform/3 is a no-op elsewhere; Bandit supports it on HTTP/1 and HTTP/2). In development and on a missing manifest the connection passes through untouched.