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
Astro の pros / cons
Search
hashiba daiki
April 21, 2023
Programming
1.4k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Astro の pros / cons
Vercel * Astro を使った開発を行い気づいた点を共有します。
hashiba daiki
April 21, 2023
Transcript
26 slides
Vercel * Astroで気づいた Astro のpros / cons Serverless Frontend Meetup
#2 「Vercel」 2023/4/21 はしば
自己紹介 - 羽柴 大生(はしば だいき) - chot Inc. 所属 -
Web フロントエンドエンジニア - 大阪出身→香川在住 - (世界一)可愛い娘がいます
今回話すこと # Astroのこと - 概要 - できること - 実際にやったこと -
pros / cons - まとめ
何を伝えたいか - フロントエンドは流行り廃りがしんどい - できることは見つけられても、できないことはなかなか見 当たらない - できることと、できないこと、実際に触って気づいたことを ベースに話します
概要(公式引用) - Astro is the all-in-one web framework designed for
speed. Pull your content from anywhere and deploy everywhere, all powered by your favorite UI components and libraries. - zero-JS - Content-focused https://astro.build/
できること - blog - portfolio - corporate - EC
できること? - blog - portfolio - corporate - EC
できる範囲 - blog - portfolio - corporate - EC
- blog … all pre-renderであれば - portfolio … all pre-renderであれば
- corporate - EC できる範囲
- blog … all pre-renderであれば - portfolio … all pre-renderであれば
- corporate … ぎりぎり - EC できる範囲
- blog … all pre-renderであれば - portfolio … all pre-renderであれば
- corporate … ぎりぎり - EC … 🥺 できる範囲?
demo(blog) / : Top page … pre-render /search : 検索ページ
… SSR /blog/[blogId] : ブログ詳細 … pre-render
実際にやったこと - HTML / CSSが静的なassetとして欲しい - JSを不用意に吐き出さない - human readableなコードが欲しい
- previewを見せる必要がある - 非エンジニアでも確認できる環境 → Vercel * Astro
良かったこと - jQueryをぬるっと入れれる - それがアンチパターンかどうかは一旦おいておいて - jsxのお作法や、v-forみたいな呪文を覚えなくても素のHTML の知識があれば対応できる - モダンフロント初めての人でも障壁が少ないように感じた
(TSもmustではない)
つらかったこと① 沢山の getElementById, addEventListener useState1行でも使うとn千行のjs fileが爆誕してしまうため、islands architecture が導入できない。 (zero-JSという特徴が死ぬ) 最初は書きやすいと思った
.astro fileが敵に見えてくる。
つらかったこと① 公式には「こう書いたらuseStateなくてもいけるで」って書いてますが、こう書きた くないから皆 React やら Vue やらを使ってるんやで https://docs.astro.build/en/guides/client-side-scripts/
つらかったこと② script, style tagが独特 - 暗黙的にglobalかinlineかが決まっている - コンポーネントの出し分けなどで中々意図した挙動にさせずらい - <script>タグにtype="module
"またはsrc以外の属性を追加すると、 Astroのデフォルトのバンドル動作が無効になり、is:inlineディレクティ ブがあるかのようにタグが扱われる
つらかったこと② script, style tagが独特 - 一応front matterから変数を渡すこともできるが、渡せる変数も 限られている(JSONでシリアライズ可能な値のみ)
つらかったこと③ いつも通りの eslint, TS ではない 当然と言えば当然ですが、 - JSX.IntrinsicElements['div'] - CSSProperties
- ReactNode などは存在しない。ReactがTSと親和性がありすぎる
つらかったこと④ 謎の挙動がある - 開発サーバーが急にこける - たまにeslintが通らない(同じコードで確認したら通るとかも ある) - buildも同様
つらかったこと④ 謎の挙動がある - 開発サーバーが急にこける - たまにeslintが通らない(同じコードで確認したら通るとかも ある) - buildも同様 →総じてReactに比べると開発者体験が辛かった🥺
ワンポイント ※特に静的なassetが欲しい場合 ・distされたデータをよく確認する ・npm scriptに頼る ・Vercelにdeployされている時とlocalの distされるデータは違う
まとめ ①静的なfileを手に入れたい ②all pre-render で簡素なサイト ③ejsの代わり(未検証)
まとめ ①静的なfileを手に入れたい ②all pre-render で簡素なサイト ③ejsの代わり(未検証) →これ以外は React, Vue などが使えるなら素直にそっち
参考 なんだかんだ公式 https://astro.build/ script tagの挙動について https://hiroppy.me/blog/astro-script-issue Astroのサンプルコードやversion2の紹介動画 https://www.youtube.com/watch?v=gi4c7fbeURc
ご視聴 & ご清聴 ありがとうございました!!!
More Decks by hashiba daiki
See All by hashiba daiki
ストックマークのAI推進について|AI Nativeな業務設計者として、組織のOSを再設計する
hashibadaiki
0
440
プロダクトアウトから価値探索へ:生成AIが加速させたエージェント開発の実践録
hashibadaiki
0
1.5k
補足資料:LLMとは?
hashibadaiki
0
53
苦しんで向き合うLLM時代の開発
hashibadaiki
13
5.1k
フロントエンドの大規模開発におけるTips
hashibadaiki
3
1.6k
Other Decks in Programming
See All in Programming
高橋メソッドでCVE解説シリーズ 〜CVE-2026-112816〜
hakkadaikon
0
270
はじめてのKubernetesコントリビューション
nasa9084
0
320
ローカルLLMの基本と近況 2611 / Local LLM basics and recent situation 2611
kishida
3
660
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
150
How SRE Grew Out of Server-Side Work and Became the Team's Own / サーバサイドから始まったSREを チームに渡すまで
maaaato
1
230
Goコンパイラを作ってGoをもっと理解する / Build a Go compiler to better understand Go
ikura_hamu
0
140
Debian JP Projectのサーバー構成
uwabami
1
180
RaspberryPi 5で軽くはじめるk3sとtailscaleを用いたホームサーバー構築 (1)
nasum
0
440
SODA - FACT BOOK(JP)
sodainc
1
40k
flutter_test のその先へ — Flutter アプリの LLM 機能に「評価」という品質保証を
kosukesaigusa
0
210
ビジネスロジックを堅牢に~Scala 3のドメインプリミティブ~
j5ik2o
0
230
Claude Codeのおかげでやりたいことがやれるようになったんだよォー!
sms_tech
0
190
Featured
See All Featured
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
70
69k
Chasing Engaging Ingredients in Design
codingconduct
0
410
Well, that’s weird…
csswizardry
1
210
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
Building AI with AI
inesmontani
PRO
1
1.4k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
320
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
121
130k
The Art of Programming - Codeland 2020
erikaheidi
57
15k
How to Talk to Developers About Accessibility
jct
2
630
Building Applications with DynamoDB
mza
96
7.3k
The Curious Case for Waylosing
cassininazir
1
630
The Spectacular Lies of Maps
axbom
PRO
1
1.1k