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
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
130
[ハンズオン]AIへの指示だけで「五目並べ」を作ってみよう
satoshi256kbyte
1
360
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
200
JRuby: Past, Present, and Future
headius
0
230
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
1
650
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
180
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
370
SREの越境 / SRE Collaboration
y0hgi
2
300
Unity6 URPによる海底をテーマにしたVJシステムの解説 | Unity Shader 完全に理解した 勉強会
gam0022
0
350
Turning Architecture into Unit Tests in the AI Era (NSSpain XIV)
steliosf
PRO
1
140
難しいけど、読めた。- OSSの入口に立った話。
sts11142
0
150
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
170
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
187
23k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
530
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
560
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Code Review Best Practice
trishagee
74
20k
Context Engineering - Making Every Token Count
addyosmani
9
1.2k
New Earth Scene 8
popppiees
4
2.7k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.2k
Between Models and Reality
mayunak
4
490
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 エンジニア募集しています! ありがとうございます