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
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
300
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
Claude Code公式skillで 自分の仕事を少しずつ手放そう!(Claude Code開発ノウハウ大公開スペシャル by クラスメソッド)
kaym
0
120
Baseline対応のDOMの型定義を作った
uhyo
3
730
DatabricksにおけるMCPソリューション
taka_aki
1
190
生成AIの活用/high_school2026
okana2ki
0
120
AWS Summit の片隅で、体育座りしながらコミュニティがにぎわう理由を考えた
k_adachi_01
2
370
SRE依存からの脱却 運用を開 発チームへ移す、 フルサイ クル開 発体制の実践
joooee0000
0
2.5k
SRE Next 2026 何でも屋からの脱却
bto
0
470
DMM.com 購入改善推進チーム におけるCodeRabbitを用いた レビューフロー改善の一例
ysknsid25
2
580
AIに「使われる」時代のSaaS戦略 〜既存WebAPIのMCPサーバー化における開発ノウハウ〜
ekispert_api
0
310
実装だけじゃない! CCA-F取得エンジニアが教えるClaude Code開発プロセス活用術
diggymo
2
500
AIと共生する開発者プラットフォーム:バクラクのモノレポ×マイクロサービス基盤
sakajunquality
2
3.2k
キャリアの中で本を作る / Making a Book During Your Career
ak1210
0
130
Featured
See All Featured
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Into the Great Unknown - MozCon
thekraken
41
2.6k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
460
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
460
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Agile that works and the tools we love
rasmusluckow
331
22k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
62
44k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Tell your own story through comics
letsgokoyo
1
990
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