Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/itchy-ghosts-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes an issue where adding new pages weren't correctly shown when using the development server.
18 changes: 17 additions & 1 deletion packages/astro/src/manifest/serialized.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Plugin } from 'vite';
import type { Plugin, ViteDevServer } from 'vite';
import { ACTIONS_ENTRYPOINT_VIRTUAL_MODULE_ID } from '../actions/consts.js';
import { toFallbackType } from '../core/app/common.js';
import { toRoutingStrategy } from '../core/app/index.js';
Expand All @@ -23,6 +23,7 @@ import { VIRTUAL_PAGES_MODULE_ID } from '../vite-plugin-pages/index.js';
import { ASTRO_RENDERERS_MODULE_ID } from '../vite-plugin-renderers/index.js';
import { ASTRO_ROUTES_MODULE_ID } from '../vite-plugin-routes/index.js';
import { sessionConfigToManifest } from '../core/session/utils.js';
import { ASTRO_VITE_ENVIRONMENT_NAMES } from '../core/constants.js';

// This is used by Cloudflare optimizeDeps config
export const SERIALIZED_MANIFEST_ID = 'virtual:astro:manifest';
Expand All @@ -37,9 +38,24 @@ export function serializedManifestPlugin({
command: 'dev' | 'build';
sync: boolean;
}): Plugin {
function reloadManifest(path: string | null, server: ViteDevServer) {
if (path != null && path.startsWith(settings.config.srcDir.pathname)) {
const environment = server.environments[ASTRO_VITE_ENVIRONMENT_NAMES.ssr];
const virtualMod = environment.moduleGraph.getModuleById(SERIALIZED_MANIFEST_ID);
if (!virtualMod) return;

environment.moduleGraph.invalidateModule(virtualMod);
}
}

return {
name: SERIALIZED_MANIFEST_ID,
enforce: 'pre',
configureServer(server) {
server.watcher.on('add', (path) => reloadManifest(path, server));
server.watcher.on('unlink', (path) => reloadManifest(path, server));
server.watcher.on('change', (path) => reloadManifest(path, server));
},

resolveId: {
filter: {
Expand Down
14 changes: 0 additions & 14 deletions packages/astro/test/fixtures/ssr-prerender-chunks/package.json

This file was deleted.

24 changes: 0 additions & 24 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.