Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Implement prerendering w/ puppeteer
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
sota ohara
July 21, 2020
Technology
340
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Implement prerendering w/ puppeteer
sota ohara
July 21, 2020
More Decks by sota ohara
See All by sota ohara
Re-Architecture of ReactNative
sottar
0
310
create own CMS from scratch
sottar
2
9.2k
Let’s try to hack AST of JavaScript
sottar
1
1.9k
フロントエンドエンジニアが伝えたい最近の事情
sottar
27
18k
複数人で高速に開発するためのnpmモジュール
sottar
5
2.7k
new version of context in React 16.3
sottar
3
1.9k
2ヶ月半でサービスをリリースした話し
sottar
2
2.3k
Redux のディレクトリ構成を考える
sottar
2
15k
モダンなJavaScriptアプリケーションでモダンにスタイリングする方法
sottar
9
5.1k
Other Decks in Technology
See All in Technology
ペアプロの価値はコードを書くことだけじゃない
codmoninc
PRO
0
200
Amazon S3 Tablesに全部任せてみた結果——コンパクション/スナップショット管理は本当に手放せるか
shigeruoda
1
480
HRC_Frontend_Conference_Fukuoka_2026.pdf
ts020
0
530
Where Is JetBrains AI Heading- — Central CLI, Air Alpha, and the Agentic Development Stack
x5gtrn
PRO
0
160
20260912_スクフェス三河
kgnkhkr
0
300
プロダクト思考 × 基盤思考を AIで実現する Compound Engineering
tkc66buzz
1
320
リージョンの壁を越える、 ちょっと変わったAWSサービスの話
falken
PRO
1
310
The Agent Builder Loop from Daily Work to OSS
minorun365
PRO
3
140
2026_devsumi_ozono.pdf
o3
3
410
越境するなら専門用語を使うな高校校歌 / If you wanna cross border, you shouldn't use jargon
vtryo
0
120
Slack上でインフラをトラブルシュートする! Agentic Platform Engineeringの第一歩
teru0x1
4
1.2k
Deploying a Full-Stack Bun-Native Framework on Cloudflare Workers
7nohe
0
140
Featured
See All Featured
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
380
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
560
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Test your architecture with Archunit
thirion
2
2.4k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
The agentic SEO stack - context over prompts
schlessera
0
920
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
10k
Un-Boring Meetings
codingconduct
0
410
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
530
Docker and Python
trallard
47
4.2k
Transcript
Implement prerendering w/ puppeteer 2020.07.21 隅田川.js#2 Sota Ohara
Sota Ohara Software Engineer at CADDi sottar_ sottar
https://www.sottar.io/
prerendering とは - Web 上でレンダリングをする方法の一つ - CSR, SSR などと並列 -
各URLに対応する個別の HTML ファイルを事前に生成しておく - TTFB, FP, FCP, TTI の最適化 - エッジキャッシュを活用しやすい - 全ての有効なURLに対してHTMLを生成しておく必要がある - Gatsby, Next.js などでサポートされている
https://developers.google.com/web/updates/2019/02/rendering-on-the-web
puppeteer を使って実装した
puppeteer とは - https://github.com/puppeteer/puppeteer - Headless Chrome Node.js API -
ヘッドレス(GUIなし)で Chrome を制御できるライブラリ - react-snap や Gatsby の内部で使われている
登場人物 react, styled-components, puppeteer, webpack, express, MySQL, npm scripts
Application npm run build ① npm run prerender ② bundle.js
index.html npm-scripts
OGP対応 - OGP タグは react-helmet を使う - OGP用の画像は puppeteer でスクリーンショットを撮ることができる
styled-components のスタイルが取得できない - puppeteer を使ってページの HTML を取得する際に styled-components で当てて いるスタイルの情報が取得できなかった
- パフォーマンス観点から CSSOM を直接読み込ませているので puppeteer で取得できない - styled-components v5 から導入された disableCSSOMInjection オプションを指定 することで回避
page source Before After
None
We Are Hiring!! https://corp.caddi.jp/recruit/eng