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
v-tokyo #13 6月16日
Search
James
June 16, 2021
Programming
130
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
v-tokyo #13 6月16日
ViteでStatic Site Generatorの事例について
James
June 16, 2021
Other Decks in Programming
See All in Programming
[DroidKnights 2026] Workflow AX: From Auto-Documented Policies to E2E Testing
raeminkang
0
510
複数ドメインを一つのアプリに統合するFlutterの設計と運用_FlutterKaigi2026登壇資料(須永高弘)
takahirosunaga
0
150
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
4
3.7k
Python Lambdaにおけるテストしやすい設計とAI支援の活用 / Designing Testable Python Lambda Functions with AI
kitano_yuichi
1
290
あなたの await、OS まで届いてる? strace で覗く JavaScript の非同期
hasutosasaki
1
2k
TS 7.0 で baseUrl が使えなくなった今、パスエイリアスをどうするか
bicstone
2
490
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
320
はじめてのPLATEAU
nokonoko1203
1
360
SODA - FACT BOOK(EN)
sodainc
1
200
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
410
AIがコードを書いてくれる時代、我々は何を確かめるのか
yosuke_furukawa
PRO
13
5.6k
高橋メソッドでCVE解説シリーズ 〜CVE-2026-112816〜
hakkadaikon
0
200
Featured
See All Featured
Designing for Performance
lara
612
70k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
Google's AI Overviews - The New Search
badams
0
1.7k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
2
1.2k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
670
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.9k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
460
GraphQLとの向き合い方2022年版
quramy
50
15k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
580
Documentation Writing (for coders)
carmenintech
77
5.6k
How to Talk to Developers About Accessibility
jct
2
610
Transcript
Vite でSSG の本番運用をやってみた 事例:特定保健指導サービスの紹介ページ JAMES ROBERTS v-tokyo #13 2021-06-16
James Roberts robjamdev Frontend Engineer @MedPeer Vue, Typescript, Cloud Architecture
が大好き 自炊も大好き🌮
特定保健指導サービスは 食事・運動等の生活の習慣を見直して、生活習慣病の発症リスクを低減させる国の制度 専門職(管理栄養士、保健師)と共に目標を立て、数カ月の支援を受ける。
紹介ページ(before) アナログなオペレーション… ユーザー(利用店舗)より電話で変更依頼 弊社スタッフは手動編集 電話で変更確認 全て、自動化! 紹介ページは外部のWeb ページ作成サービスを利用 特定保険指導の予約可能の店舗(350+) 情報を表示
紹介ページ Architecture (after) ユーザー(利用店舗)が店舗の情報を自分で編集 紹介ページを更新する API Server がLambda(Vite のSSG) を実行する
Lambda の実行の内容 html をrender する script を削除する Client Side Hydration のfragment 削除する 生成した結果をS3 に保存
なぜVite? prerendering(SSR) が必要 本体のproject はNuxtJs なのでに移行しやすい Vite で検証できるプロジェクト Vite は早いから
Vite のSSR `main.js` にLambda のイベントデータを渡す NodeJs の環境でrequire のimport が必須 `provide/inject`
で `App.vue` に参照できるようにする Vite dev の場合はES6 のimport で良い https://Vitejs.dev/guide/ssr.html 開発時点 v1.0.0-rc13 ` ` export const createApp = (context) => { // main.js if (isSSR) { const app = createSSRApp(App); app.provide('subdomain', context.subdomain); // ... return app; } else { const app = createClientApp(App); app.provide('subdomain', context.subdomain); return app; } } if(!isSSR) { createApp(context).mount('#app'); }
Vite のSSR からSSG Lambda の入り口 先の `main.js` の createApp SSR
のコンテンツ 正規表現で必要ないものを削除する 開発時点 v1.0.0-rc13 ` ` exports.handler = async (event) => { const renderer = require('@vue/server-renderer'); const { createApp } = require('ssr/_assets/index.js'); const app = createApp(event); const content = await renderer.renderToString(app); content.replace(/<!--[\[-\]]-->/g, ''); // js script を削除する // S3 にupload }
まとめ 顧客と弊社スタッフの高評価 PaaS で最適なソリューションはよかった Vite がいいぞ!(V2 だともっと簡単) Vite でserverless はいい感じ!
Credits スライドはslidev で作りました🎉 スライド: https://speakerdeck.com/robjam/v-tokyo-6yue-16ri エンジニア募集しています! ありがとうございます