withastro / starlight

🌟 Build beautiful, accessible, high-performance documentation websites with Astro
https://starlight.astro.build
MIT License
5.01k stars 532 forks source link

Hybrid mode for astro SSR does not prerender pages on Mac #1989

Closed LunaticMuch closed 5 months ago

LunaticMuch commented 5 months ago

What version of starlight are you using?

0.23.4

What version of astro are you using?

4.10.1

What package manager are you using?

npm

What operating system are you using?

Mac

What browser are you using?

Edge

Describe the Bug

Astro seems not able to pre-render pages in a hybrid environment. According to the manual, astro pages are always pre-rendered which should make it compatible with an hybrid installation. However, using such config leads to no starlight page pre-rendered. All other astro pages, outside starlight, are prerendered. I found this noticing that during the build, pagefind was not finding any html page.

output: "hybrid",
  adapter: nodejs({
    mode: "standalone",
}),

Without the hybrid mode:

 generating static routes 
12:52:26 ▶ @astrojs/starlight/404.astro
12:52:26   └─ /404.html (+8ms)
12:52:26 ▶ src/pages/schema/[...slug].astro
12:52:26   ├─ /schema/1/index.html (+6ms)
12:52:26   ├─ /schema/2/index.html (+4ms)
12:52:26   └─ /schema/3/index.html (+4ms)
12:52:26 ▶ @astrojs/starlight/index.astro
12:52:26   ├─ /guides/example/index.html (+4ms)
12:52:26   ├─ /index.html (+14ms)
12:52:26   └─ /reference/example/index.html (+4ms)
12:52:26 ✓ Completed in 62ms.

and with the hydrid mode enabled:

 prerendering static routes 
12:52:54 ▶ src/pages/schema/[...slug].astro
12:52:54   ├─ /schema/1/index.html (+13ms)
12:52:54   ├─ /schema/2/index.html (+3ms)
12:52:54   └─ /schema/3/index.html (+3ms)
12:52:54 ✓ Completed in 35ms.

I am working to a reproducible example. The one on Stackblitz seems to work, but the exact same repo on my local macbook M3 does not.

Link to Minimal Reproducible Example

https://stackblitz.com/~/github.com/LunaticMuch/fuzzy-giggle

Participation

HiDeoo commented 5 months ago

Thanks for your report.

Is this the exact same repro you're testing or something similar? I'm asking because I just tried downloading the repro and building it on macOS and did not get the issue you're seeing.

The only change I made was removing the ../../assets/houston.webp mention in src/content/docs/index.mdx as I assume it's just an asset missing in StackBlitz.

I used the "Download ZIP" button in the file explorer to download the repro and ran npm install and npm run build as the configuration already contained output: "hybrid", and the Node.js adapter.

If you re-download the repro and try again, does it still fail for you?

LunaticMuch commented 5 months ago

It's the same one running from my local. I built it because I have another repo which actually behave bizarrely in the same way. Only difference, I locally used a company proxy for downloading dependencies instead of the public npm registry.

I actually tried to reproduce it locally, using npmjs.org as registry, and I have it. This is way too weird.

LunaticMuch commented 5 months ago

If you re-download the repro and try again, does it still fail for you?

Yes, I actually tried also from my own macbook...same issue. Do you know how could I potentially debug/trace it?

LunaticMuch commented 5 months ago

I think it's an astro related problem. I will open a bug there. Right now you can look the following logs for MacOS and Codesandbx

Same repo, different behaviour. The only real difference is the underlying OS.

LunaticMuch commented 5 months ago

Problem identified. Not a Starlight problem.