Skip to content

refactor: Make 'vite-prerender-plugin' optional#184

Draft
rschristian wants to merge 3 commits intov3from
refactor/optional-prerender-plugin
Draft

refactor: Make 'vite-prerender-plugin' optional#184
rschristian wants to merge 3 commits intov3from
refactor/optional-prerender-plugin

Conversation

@rschristian
Copy link
Member

As of today, it brings in 18 deps (some of which may be deduped, not sure) and it's not necessarily something everyone wants or needs; better to lighten the load and make it an optional peer dep instead. Users can configure & access it through the Preact plugin but will be able to control the version themselves a bit more freely.

Alternatively, we can strip it out altogether if people prefer; I don't have too much of an opinion.

@rschristian rschristian mentioned this pull request Mar 10, 2026
Draft
Comment on lines -66 to -74
if (!prerender.previewMiddlewareEnabled) {
const idx = prerenderPlugin.findIndex(
p => p.name == "serve-prerendered-html",
);
if (idx > -1) {
prerenderPlugin.splice(idx, 1);
}
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vite's preview server routes everything back to index.html, which is a problem when testing prerendered apps as few people are actually using paths like /foo.html to navigate.

I added a plugin years ago to help with this but cautiously made it opt-in here to avoid any potential for breaking changes. We can remove this now, IMO.

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.

1 participant