pub struct ModulePreloads { /* private fields */ }Expand description
Each route’s static ESM dependencies, as the build’s manifest lists them
in modulepreload (@getforma/build with codeSplitting).
forma-server writes one <link rel="modulepreload"> per file into the
route’s head, after the route’s own modules, with the page’s nonce: under
'strict-dynamic' a preload without it is dropped. Load the table once at
start with assets::try_load_module_preloads
and hand it to each render through
RenderCtx::with_module_preloads;
cloning it is cheap. Dynamically imported chunks are not in the list: the
build leaves them out, so they load when the page asks for them.
The table is the one from the manifest at start. A render resolves every listed file’s integrity through its current manifest snapshot. If development renames a chunk out of that snapshot, rendering refuses with RENDER-104 until the application replaces its preload table; no unchecked tag is emitted. A static SSR route refuses a nonempty request table with RENDER-105 even when those files remain valid retained assets in the current manifest.
Verified by: crates/forma-server/tests/internal_renderer/typed_homes.rs > “try_render_writes_the_routes_manifest_modulepreload_links_nonced”