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
Laravel x Vite
Search
Kuro Hsu
August 05, 2021
Technology
680
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Laravel x Vite
Laravel x Vite / Kuro Hsu
@ PHP 也有 Day #60
Kuro Hsu
August 05, 2021
More Decks by Kuro Hsu
See All by Kuro Hsu
[.NET Conf 2020 Taiwan] 以輕前端視角進入 Vue 3.0 的世界
kurotanshi
0
780
[MOPCON 2020] vite: Make web dev fast again
kurotanshi
0
2.5k
[ModernWeb'20] Vue.js :The Bad Parts
kurotanshi
1
170
[MOPCON 2019] Vue.js 3.0 與 Composition API 的變革
kurotanshi
1
1.4k
[JSDC2019] 我有一堆選擇 Vue 開發框架的理由
kurotanshi
1
840
[COSCUP 2019] 前端工程師的養成之路與開源工具
kurotanshi
3
450
初探 Vue 3.0 Function API
kurotanshi
4
3.1k
VueJS Style Guide 導讀
kurotanshi
6
1.9k
[JSDC2017] 從 VueJS 看前端生態圈的發展變化
kurotanshi
9
2.5k
Other Decks in Technology
See All in Technology
MIERUNE JCT 発表資料「宇宙から伊能忠敬ごっこ」
syuchimu
0
180
JEP 522 Deep Dive - G1 GC同期コスト削減によるスループット向上を徹底検証&解説
tabatad
1
860
ブロックチェーン / Blockchain
ks91
PRO
0
110
さきさん文庫の書籍ができるまで
sakiengineer
0
370
もりもり新機能を一挙紹介! AgentCoreに入門して、AWS上にAIエージェントを構築しよう
minorun365
PRO
6
810
Oracle Cloud Infrastructure IaaS 新機能アップデート 2026/3 - 2026/5
oracle4engineer
PRO
1
190
ポケモンの型をTypeScriptの型システムで表現してみた
subroh0508
0
330
Ruby::Boxでできること、Refinementsでできること
joker1007
3
390
2026.06.13_AI時代に事業会社が「SIer出身エンジニア」を求める理由 / Why Businesses Seek Engineers with a System Integrator Background in the AI Era
jumtech
0
500
AI駆動開発が変える、大規模開発の前提 ーHuman in the Loop から Human on the Loop へ / AIE2026
visional_engineering_and_design
7
4.9k
AIプラットフォームを運用し続けるための可観測性
tanimuyk
4
1.1k
【Gen-AX】20260530開催_JJUG CCC 2026 Spring
genax
0
420
Featured
See All Featured
A Soul's Torment
seathinner
6
2.9k
GitHub's CSS Performance
jonrohan
1033
470k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
350
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
380
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
280
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.5k
Ethics towards AI in product and experience design
skipperchong
2
300
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
250
Being A Developer After 40
akosma
91
590k
Transcript
Kuro Hsu @ PHP 也有 Day #60 2021/08/05 Laravel x
Vite
Kuro Hsu Front-End Developer Organizers of Vue.js Taiwan (Vue.tw) https://kuro.tw
[email protected]
@kurotanshi
Vite 是什麼 vite ⚡ 發音 /vit/ ,是法語中「快速」的意思 由 Vue.js 的作者
Evan You 所開發 快速啟動、即時更新的前端 「開發工具」 不只 親兒子 Vue, React 也能用! https://github.com/vitejs/vite
None
實際對比: 以 React Create App 為例 Link
Vite 為什麼這麼快
Vite 為什麼這麼快
以 Bundle 為基礎 (webpack)
以 ES Module 為基礎 (vite、snowpack)
橫向對比
更多相關細節 [MOPCON 2020] vite: Make web dev fast again
今日重點 - Vite ❤️ Laravel
基本需求 Laravel: PHP 7.4+ Vite: Node 12+ 開發用 瀏覽器需支援 ES
Module 若需支援舊版瀏覽器 ,須另外安裝 @vitejs/plugin-legacy
開始與起步 首先要有一個 laravel 專案: 切換到專案目錄,並執行: 1 $ composer create-project laravel/laravel
example-app 1 $ npx apply laravel:vite
手動處理 或者也可以自行處理: 1 # 手動移除 laravel-mix 2 rm webpack.mix.js 3
yarn remove laravel-mix 1 # 安裝必要套件,此步驟不可省略! 2 composer require innocenzi/laravel-vite 3 yarn add vite laravel-vite --dev
設定 編輯 vite.config.ts 檔案 1 // vite.config.ts 2 import {
defineConfig } from 'laravel-vite' 3 import vue from '@vitejs/plugin-vue' 4 5 export default defineConfig() 6 .withPlugin(vue) 7 .merge({ 8 // Your own Vite options 9 })
設定 編輯 package.json 檔案 1 // package.json 2 "scripts": {
3 "dev": "vite", 4 "build": "vite build", 5 "serve": "vite preview" 6 }, 3 "dev": "php artisan serve & vite", // 同時啟動 artisan serve 與 vite 1 // package.json 2 "scripts": { 4 "build": "vite build", 5 "serve": "vite preview" 6 },
這是用來更新靜態檔的 vite 服務 注意,這才是開發用網頁伺服器
Hello Vite!
更多資訊 Laravel Vite ViteJS vite2: Make Web Dev Fast Again
& Again