Skip to content

dev-vite-scripts

Tag helper Development

Renders a SPA in development by loading the Vite client and your entrypoint from the running dev server, giving you hot module replacement inside a Razor page. Reads manifest.dev.json.

<dev-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.
  • For React apps (isReact: true), a <script static-script type="module"> block injecting the React refresh runtime preamble.
  • The container element: <div id="{containerElementId}"></div>.
  • A loader script that fetches your entrypoint from http://localhost:{port}/{entrypoint}, and once it responds, appends the Vite client (/@vite/client) and the entrypoint as module scripts.
  • A fallback: if the entrypoint can’t be fetched within the retry window, it replaces the container contents with a “Vite Dev Server Not Found” message.

The helper resolves these from the dev manifest (falling back to defaults if the manifest is absent because the dev server hasn’t started):

PropertySourceDefault
Portmanifest.dev.jsonport5173
Entrypointmanifest.dev.jsonentrypoint""
ContainerElementIdmanifest.dev.jsoncontainerElementId"app"
IsReactmanifest.dev.jsonisReactfalse
  • The integration must be registered — see AddViteIntegration.

  • The tag helpers must be registered in _ViewImports.cshtml:

    @addTagHelper *, ViteDotNet
  • The Vite dev server must be running so manifest.dev.json exists and the entrypoint is reachable.