-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: not all pages are pre-rendered #5475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
FatahChan
wants to merge
37
commits into
TanStack:main
Choose a base branch
from
FatahChan:fix/prerendering
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+251
−24
Open
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
77fc5cf
fix: pre-rendering all static pages
FatahChan c1798fa
fix: build test
FatahChan 02f1298
debugging
FatahChan a86d140
fix: update prerendering logic to use generator for static paths and …
FatahChan e319ea1
fix: update prerenderPages to track prerendered pages instead of seen…
FatahChan 5bf61f8
feat: add dummy server scripts and update test commands for prerendering
FatahChan de3a355
docs: enhance static prerendering documentation with automatic route …
FatahChan 1e486a3
ci: apply automated fixes
autofix-ci[bot] 04c2890
fix: remove unnecessary logging of startConfig.pages in prerender fun…
FatahChan 0192c7b
feat: implement prerenderRoutesPlugin
FatahChan a1d8e47
fix: rename redirectCount to maxRedirect and add warning
FatahChan df99119
ci: apply automated fixes
autofix-ci[bot] 349d719
chore: align naming maxRedirect
FatahChan a43b1a2
chore: Add fallback for empty discovery results.
FatahChan e9c62f1
ci: apply automated fixes
autofix-ci[bot] 30abba8
feat: enhance prerendering configuration with automatic static paths …
FatahChan 12b91ff
ci: apply automated fixes
autofix-ci[bot] a175f54
fix: handle undefined TSS_PRERENDABLE_PATHS in prerender function
FatahChan 0eba284
ci: apply automated fixes
autofix-ci[bot] 42d82ee
fix: correct typo in prerendering error handling comment
FatahChan aec1ea0
fix: add missing comma in prerender configuration
FatahChan 6a2cd74
fix: handle undefined headers in prerender options
FatahChan 4cf866c
ci: apply automated fixes
autofix-ci[bot] 6be5de2
test: add test to e2e:basic instead of a new e2e
FatahChan f63f8ee
ci: apply automated fixes
autofix-ci[bot] 7c6fb62
fix: clarify automatic static route discovery and crawling links sect…
FatahChan 4dd5c5f
ci: apply automated fixes
autofix-ci[bot] c02af7b
fix: remove deprecated e2e/react-start/basic-prerendering dependencies
FatahChan bd59aaa
fix: restore lock file
FatahChan a6dac9d
fix: update static prerendering documentation for clarity and additio…
FatahChan f27c5d3
fix: remove unnecessary --ui flag from prerender test command
FatahChan bb188a4
fix: clarify autoStaticPathsDiscovery behavior in static prerendering…
FatahChan af74015
fix: enable autoStaticPathsDiscovery and update Solid plugin imports …
FatahChan 442a5ec
fix: improve clarity in static prerendering documentation regarding p…
FatahChan 5e32fa5
fix: add prerendering tests for static path discovery and content ver…
FatahChan 1cf05b1
fix: standardize maxRedirect option naming to maxRedirects across doc…
FatahChan 8d25746
fix: enforce minimum value for maxRedirects option in start plugin sc…
FatahChan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { existsSync, readFileSync } from 'node:fs' | ||
import { join } from 'node:path' | ||
import { expect } from '@playwright/test' | ||
import { test } from '@tanstack/router-e2e-utils' | ||
import { isPrerender } from './utils/isPrerender' | ||
|
||
test.describe('Prerender Static Path Discovery', () => { | ||
test.skip(!isPrerender, 'Skipping since not in prerender mode') | ||
test.describe('Build Output Verification', () => { | ||
test('should automatically discover and prerender static routes', () => { | ||
// Check that static routes were automatically discovered and prerendered | ||
const distDir = join(process.cwd(), 'dist', 'client') | ||
|
||
// These static routes should be automatically discovered and prerendered | ||
expect(existsSync(join(distDir, 'index.html'))).toBe(true) | ||
expect(existsSync(join(distDir, 'posts.html'))).toBe(true) | ||
expect(existsSync(join(distDir, 'users.html'))).toBe(true) | ||
expect(existsSync(join(distDir, 'deferred.html'))).toBe(true) | ||
expect(existsSync(join(distDir, 'scripts.html'))).toBe(true) | ||
expect(existsSync(join(distDir, 'inline-scripts.html'))).toBe(true) | ||
expect(existsSync(join(distDir, '대한민국.html'))).toBe(true) | ||
|
||
// Pathless layouts should NOT be prerendered (they start with _) | ||
expect(existsSync(join(distDir, '_layout', 'index.html'))).toBe(false) // /_layout | ||
|
||
// API routes should NOT be prerendered | ||
|
||
expect(existsSync(join(distDir, 'api', 'users', 'index.html'))).toBe( | ||
false, | ||
) // /api/users | ||
}) | ||
}) | ||
|
||
test.describe('Static Files Verification', () => { | ||
test('should contain prerendered content in posts.html', () => { | ||
const distDir = join(process.cwd(), 'dist', 'client') | ||
expect(existsSync(join(distDir, 'posts.html'))).toBe(true) | ||
|
||
// "Select a post." should be in the prerendered HTML | ||
const html = readFileSync(join(distDir, 'posts.html'), 'utf-8') | ||
expect(html).toContain('Select a post.') | ||
}) | ||
|
||
test('should contain prerendered content in users.html', () => { | ||
const distDir = join(process.cwd(), 'dist', 'client') | ||
expect(existsSync(join(distDir, 'users.html'))).toBe(true) | ||
|
||
// "Select a user." should be in the prerendered HTML | ||
const html = readFileSync(join(distDir, 'users.html'), 'utf-8') | ||
expect(html).toContain('Select a user.') | ||
}) | ||
}) | ||
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const isPrerender: boolean = process.env.MODE === 'prerender' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.