Skip to content

multi route SSG #463

@CharlesJu1

Description

@CharlesJu1

Describe the bug

I have a simple app with two routes / and /pricing. I configured to generate for both routes. In dist, index.html and pricing.html are generate. Both are prerendered with correct html content. Then I run npm run preview. When visiting / and /pricing, the browser displays ok. when visiting /pricing.html, the browser is blank. From devtool, I can see that when visiting /pricing.html, the pricing.html file is fetched over network. But it is showing blank. When visiting /pricing, it gets the same /pricing.html file (index.html is not fetched), but displays ok. I verified with curl that in both cases the request returns the same file. Also the devtools network tab shows the same set of requests are sent for the bundled js, css, and detector.js.

index.html

vite.config.ts

main-ssg.ts

Reproduction

  1. setup ssg build as in the attached vite.config.ts. 2. npm run build 3. npm run preview

System Info

System:
    OS: macOS 15.6.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 22.48 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 22.12.0 - /Users/cju/.nvm/versions/node/v22.12.0/bin/node
    npm: 10.9.0 - /Users/cju/.nvm/versions/node/v22.12.0/bin/npm
  Browsers:
    Chrome: 141.0.7390.108

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Contributions

  • I am willing to submit a PR to fix this issue
  • I am willing to submit a PR with failing tests (actually just go ahead and do it, thanks!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions