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" />Attributes
Section titled “Attributes”| Attribute | Type | Required | Description |
|---|---|---|---|
app-name | string | Only when more than one app is configured | The SPA directory name to render. With a single configured app it may be omitted. |
What it renders
Section titled “What it renders”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.
Resolved values
Section titled “Resolved values”| Property | Source |
|---|---|
AppManifest | Vite’s manifest.json — the entry chunk, providing file (hashed JS) and css (hashed stylesheets). |
ProdManifest | The plugin’s manifest.prod.json — integration metadata. |
ContainerElementId | manifest.prod.json → containerElementId (default "app"). |
Requirements
Section titled “Requirements”- The integration must be registered — see AddViteIntegration.
- The tag helpers must be registered in
_ViewImports.cshtml. - The SPA must be built (
npm run build) sowwwroot/{appFolder}/manifest.jsonandmanifest.prod.jsonexist.
Related
Section titled “Related”- dev-vite-scripts — the development counterpart.
- Production Builds — building and serving the assets.