Skip to content

prod-vite-scripts

Tag helper Production

Renders a SPA in production by emitting the script and style tags for the hashed bundle in wwwroot. Reads Vite’s manifest.json for the hashed asset paths and manifest.prod.json for the container element id. No dev server is involved.

<prod-vite-scripts app-name="ReactApp" />
AttributeTypeRequiredDescription
app-namestringOnly when more than one app is configuredThe SPA directory name to render. With a single configured app it may be omitted.

When both manifests are present:

  • One <link rel="stylesheet" href="/{css}" /> per CSS file in the entry chunk.
  • <script type="module" src="/{jsBundle}"></script> for the hashed JS bundle.
  • The container element: <div id="{containerElementId}"></div>.

When the production manifest is missing, it renders a “Production Bundle not found” message instead — a hint that the SPA hasn’t been built or the configured directory name is wrong.

PropertySource
AppManifestVite’s manifest.json — the entry chunk, providing file (hashed JS) and css (hashed stylesheets).
ProdManifestThe plugin’s manifest.prod.json — integration metadata.
ContainerElementIdmanifest.prod.jsoncontainerElementId (default "app").
  • The integration must be registered — see AddViteIntegration.
  • The tag helpers must be registered in _ViewImports.cshtml.
  • The SPA must be built (npm run build) so wwwroot/{appFolder}/manifest.json and manifest.prod.json exist.