Skip to content

fix: load user's Vite config in collectPrerenderPaths - #16

Closed
hyfdev wants to merge 8 commits into
mainfrom
fix/collect-prerender-paths-user-plugins
Closed

hyfdev wants to merge 8 commits into
mainfrom
fix/collect-prerender-paths-user-plugins

Conversation

@hyfdev

@hyfdev hyfdev commented Mar 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

collectPrerenderPaths() previously created a bare Vite dev server without loading the user's config. This meant ssrLoadModule() ran getPrerenderPaths() in a different environment than the user's actual app — missing plugins, resolve aliases, SSR options, and any other config the user depends on. Any code that relied on user-configured Vite behavior would silently break.

Now it loads the user's full vite.config via loadConfigFromFile(), ensuring ssrLoadModule() runs in the same environment as the rest of the build.

Changes

  • Load user's Vite config (filtering out @cloudflare/vite-plugin plugins that break ssrLoadModule)
  • Use process.env.NODE_ENV for mode detection when loading config
  • Throw on failed config load instead of silent fallback
  • Throw on prerender path resolution errors instead of console.warn
  • Test: tags/[tag] fixture with virtual:tags plugin

Consolidates #13 (virtual module tests) and #14 (console.warn → throw).

Copilot AI review requested due to automatic review settings March 3, 2026 08:14

This comment was marked as outdated.

@hyfdev
hyfdev force-pushed the fix/collect-prerender-paths-user-plugins branch from 241d5f3 to a64c031 Compare March 3, 2026 11:59
@hyfdev hyfdev changed the title fix: load user plugins in collectPrerenderPaths for virtual module support fix: load user's Vite config in collectPrerenderPaths for virtual module support Mar 3, 2026
@hyfdev
hyfdev force-pushed the fix/collect-prerender-paths-user-plugins branch from a64c031 to bc8e1e2 Compare March 3, 2026 12:14
@hyfdev hyfdev changed the title fix: load user's Vite config in collectPrerenderPaths for virtual module support fix: load user's Vite config in collectPrerenderPaths Mar 3, 2026
@hyfdev
hyfdev force-pushed the fix/collect-prerender-paths-user-plugins branch 3 times, most recently from f5b3035 to 2a79e56 Compare March 3, 2026 12:23
@hyfdev

This comment was marked as outdated.

…port

collectPrerenderPaths() now loads the user's full vite.config via
loadConfigFromFile() so that user-defined plugins (virtual modules,
resolve aliases, etc.) are available when ssrLoadModule() runs
getPrerenderPaths().

- Use process.env.NODE_ENV for mode detection
- Throw on failed config load instead of silent fallback
- Throw on prerender path resolution errors instead of console.warn
- Replace categories test fixture with tags/virtual:tags fixture
@hyfdev
hyfdev force-pushed the fix/collect-prerender-paths-user-plugins branch from 2a79e56 to 2e9c5ca Compare March 4, 2026 02:49
@yyx990803 yyx990803 closed this in e6f37ae Mar 8, 2026
@cpojer
cpojer deleted the fix/collect-prerender-paths-user-plugins branch May 7, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants