Skip to content

fix(ssg): clean pages/ and app/ before webstudio build to avoid stale imports#11

Closed
vianmora wants to merge 1 commit into
mainfrom
fix/stale-pages-after-rename-v2
Closed

fix(ssg): clean pages/ and app/ before webstudio build to avoid stale imports#11
vianmora wants to merge 1 commit into
mainfrom
fix/stale-pages-after-rename-v2

Conversation

@vianmora

@vianmora vianmora commented May 7, 2026

Copy link
Copy Markdown
Contributor

Problem

When a page is renamed or deleted in the Webstudio builder, `webstudio build --template ssg` updates `app/generated/` (removes the old data file, adds the new one) but leaves orphaned `+Page.tsx` files in `pages/`.

Vite then fails during the static build because the stale `+Page.tsx` still imports the now-deleted `generated` file:

```
Could not resolve "../../../../app/generated/[templates].[copy-1].[chartegraphique]._index"
from "pages/templates/copy-1/chartegraphique/+Page.tsx"
```

Fix

Delete `pages/` and `app/` before each `webstudio build --template ssg` so the CLI always starts from a clean state. The `node_modules/` directory is preserved to avoid reinstalling dependencies unnecessarily.

Test plan

  • Rename a page in the builder, publish → build should succeed
  • Delete a page in the builder, publish → build should succeed
  • Normal publish (no renames) → build should succeed
  • First publish on a new domain → build should succeed

🤖 Generated with Claude Code

… imports

When a page is renamed or deleted in the builder, webstudio build --template ssg
updates __generated__/ but leaves orphaned +Page.tsx files in pages/. Vite then
fails to resolve the broken import from the stale page file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vianmora vianmora closed this May 7, 2026
@vianmora vianmora deleted the fix/stale-pages-after-rename-v2 branch May 17, 2026 16:00
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