Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Implement prerendering w/ puppeteer
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
sota ohara
July 21, 2020
Technology
320
1
Share
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
290
create own CMS from scratch
sottar
2
9.1k
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.8k
2ヶ月半でサービスをリリースした話し
sottar
2
2.3k
Redux のディレクトリ構成を考える
sottar
2
15k
モダンなJavaScriptアプリケーションでモダンにスタイリングする方法
sottar
9
5k
Other Decks in Technology
See All in Technology
【PHPカンファレンス小田原2026】Webアプリケーションエンジニアにも知ってほしい オブザーバビリティ の本質
fendo181
0
190
仕様通り動くの先へ。Claude Codeで「使える」を検証する
gotalab555
8
2.2k
Webアクセシビリティは“もしも”に備える設計
tomokusaba
0
160
Oracle AI Databaseデータベース・サービス: BaseDB/ExaDB-Dの可用性
oracle4engineer
PRO
1
120
Goビルドを理解し、 CI/CDの高速化に挑む
satoshin
0
130
TUNA Camp 2026 京都Stage ヒューリスティックアルゴリズム入門
terryu16
0
670
AWSで2番目にリリースされたサービスについてお話しします(諸説あります)
yama3133
0
120
Databricks Lakebaseを用いたAIエージェント連携
daiki_akimoto_nttd
0
150
バックオフィスPJのPjMをコーポレートITが担うとうまくいく3つの理由
yueda256
1
270
OPENLOGI Company Profile
hr01
0
83k
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.1k
チームで育てるAI自走環境_20260409
fuktig
0
720
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
55
8.1k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
250
Making the Leap to Tech Lead
cromwellryan
135
9.8k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.1k
Into the Great Unknown - MozCon
thekraken
40
2.3k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
190
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
160
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
120
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
470
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.7k
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