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
Laravel x Vite
Search
Kuro Hsu
August 05, 2021
Technology
740
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
Transcript
20 slides
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
More Decks by Kuro Hsu
See All by Kuro Hsu
[.NET Conf 2020 Taiwan] 以輕前端視角進入 Vue 3.0 的世界
kurotanshi
0
850
[MOPCON 2020] vite: Make web dev fast again
kurotanshi
0
2.5k
[ModernWeb'20] Vue.js :The Bad Parts
kurotanshi
1
270
[MOPCON 2019] Vue.js 3.0 與 Composition API 的變革
kurotanshi
1
1.4k
[JSDC2019] 我有一堆選擇 Vue 開發框架的理由
kurotanshi
1
940
[COSCUP 2019] 前端工程師的養成之路與開源工具
kurotanshi
3
530
初探 Vue 3.0 Function API
kurotanshi
4
3.2k
CSS 不是我們想像的這麼簡單! [台北場]
kurotanshi
10
2.8k
VueJS Style Guide 導讀
kurotanshi
6
2k
Other Decks in Technology
See All in Technology
信頼性を犠牲にせず、PR マージからデプロイまで人の介入を完全にゼロにするまでの道のり
knwoop
4
2.1k
自動計装なしでECSサービスをApplication Signalsに載せるまで
ota1022
2
470
MCPでネットワーク障害調査を自動化する前に直すべき3つのこと
yama3133
1
660
フロントエンドのテストカバレッジは 100%強制がいい
bengo4com
5
1.5k
クラウドでも使えるNetApp -現場目線での設計とクラウドバックアップの活用
ryutakondo
1
320
Amazon Bedrock AgentCore の基礎とセキュリティ・ガバナンス
ren8k
0
270
20261119_AgentCore
takuyay0ne
2
260
そのイメージ、どのCIが作った? Artifact Attestationsで来歴を固定する / Which CI system created that image? Pinning provenance with Artifact Attestations
chmikata
0
270
認知負荷の減らし方 ~開発にも日常業務にも活かせるノウハウ~
minorun365
PRO
17
10k
パスワードのない鍵で、 データを手元に置く
ginjihayashi
0
400
設計手法を「道具」として使いこなすために
a_suenami
7
1.7k
サーバーラックは作る時代! 3Dプリンターで作る10インチラックのススメ
jacopen
2
520
Featured
See All Featured
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
470
Evolving SEO for Evolving Search Engines
ryanjones
0
370
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
310
How Software Deployment tools have changed in the past 20 years
geshan
3
35k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
750
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
Side Projects
sachag
456
43k
How GitHub (no longer) Works
holman
316
150k
Crafting Experiences
bethany
1
460
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.5k
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k