Skip to content

SSR manifest embeds the source index.html, not the built client index.html #696

Closed

Description

@Brooooooklyn

Found while reviewing #685. Older than it.

angular-ssr-manifest-plugin.ts buildStart reads resolve(root, 'index.html'), the source page, and embeds it as the server's index.server.html asset. The Angular CLI serves the built browser index.html, which has the hashed <script> / <link> tags.

source index.html   <script type="module" src="/src/main.ts">   ← what the SSR response gets
built  index.html   <script type="module" src="/assets/index-AbC123.js">  ← what the browser needs

So the server-rendered page points at /src/main.ts, which doesn't exist in production, and the client app never boots or hydrates. Applies to vite build --ssr and to Environment API builds (vite build --app, where the client builds first).

Possible direction: in server environments, use the client environment's built index.html (its resolved build.outDir, or capture it in the client's generateBundle). Fall back to the source file with a warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions