Skip to content

Commit

Permalink
eplace puppeteer with playwright to prerender pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Asvarox committed Oct 10, 2024
1 parent c2f52da commit 5d4c9b5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 465 deletions.
1 change: 1 addition & 0 deletions .github/templates/run-playwright/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ runs:
path: |
playwright-report
test-results
build
2 changes: 0 additions & 2 deletions .github/templates/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@ runs:
cache: 'pnpm'
- run: pnpm install
shell: bash
- run: pnpm exec puppeteer browsers install chrome
shell: bash
7 changes: 3 additions & 4 deletions docs/prerendering-ssg.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ putting params of the URL the query string this is now mitigated.
## Solution
During build, all known paths (kept in `src/routePaths.ts`) are passed to
[vite-plugin-html-prerender](https://github.com/saeedafzal/vite-plugin-html-prerender), which then uses Puppeteer to render
the pages and save them in appropriate folder structure.

Although the plugin is niche and not very popular, it's simple enough to be easily ported to this project and make it
compatible with it if it gets abandoned.
the pages and save them in appropriate folder structure. The project is copied and modified so it
1. Handles custom `basePath` (needed for branch deployment)
2. Uses Playwright rather than Puppeteer for rendering (so there's no need to double-install the browsers)

## Alternative solutions considered
### Next.js
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@
"postcss": "^8.4.38",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
"puppeteer": "^21.11.0",
"react-refresh": "^0.14.0",
"rollup-plugin-analyzer": "^4.0.0",
"rollup-plugin-visualizer": "^5.12.0",
Expand Down
Loading

0 comments on commit 5d4c9b5

Please sign in to comment.