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
Use Webpack + Vue-Loader in VS2017
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Anny Chang
August 31, 2017
Programming
450
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Use Webpack + Vue-Loader in VS2017
簡報於 Kingston 2017 Team workshop
Anny Chang
August 31, 2017
More Decks by Anny Chang
See All by Anny Chang
Facebook Instant Articles - 測試到發布
annilla
1
300
Other Decks in Programming
See All in Programming
Web Framework Benchmark Battle 2026, Any%
a_matsuda
3
3.1k
JIS keyboard support in Omarchy
lef237
0
170
React Native에 현대적인 빌드 도구 더하기: Rollipop 구현기
leegeunhyeok
0
170
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
380
クラウドゲーミングのパフォーマンス最適化に挑む / Cloud Gaming Performance Tuning
vivion
0
310
dotNET_vulnclicker_intro.pdf
deka_morita
0
160
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
12
7.8k
LLM 101
dalinaum
0
410
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
4
1.4k
SODA - FACT BOOK(JP)
sodainc
1
40k
우리의 Nitro Modules는 당신의 Turbo Modules보다 아름답다
l2hyunwoo
0
240
Seven New Principles of Software Engineering
yegor256
0
400
Featured
See All Featured
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
600
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.4k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
380
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
The untapped power of vector embeddings
frankvandijk
2
2k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
540
Making the Leap to Tech Lead
cromwellryan
135
10k
BBQ
matthewcrist
90
10k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
390
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
Building Better People: How to give real-time feedback that sticks.
wjessup
371
20k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Transcript
USE WEBPACK + VUE-LOADER IN VS2017 Anny Chang
WHY WEBPACK? 節省整理和維護前端靜態檔案的時間 1
WEBPACK 拆分程式碼片段
WEBPACK 減少初始化載入時間
WEBPACK 靜態資源模組化
WEBPACK 整合第三方模組
WEBPACK 依照需求自訂修改
WEBPACK 支援 hot-reload
WEBPACK 優點 整合第三方模組 npm plugins… angular, react, vue, es6, typescript,
sass, postcss, 愛用什麼就裝 什麼.全部幫你打包成瀏覽器 看得懂 依照需求自訂修改 客製程式打包結果,資料夾結 構想長怎樣就怎樣 支援 hot-reload 開發階段改任何 js, css 瀏覽 器自動刷新 拆分程式碼片段 能夠拆分相依性的關係結構 變成程式碼片段,然後依據需 求載入 減少初始化載入時間 可做到只輸出一隻 css 一隻 js 靜態資源模組化 每一個靜態資源檔都能被模 組化,images, files 使用 hash, 大小限制…
WEBPACK
WHY VUE-LOADER? 網頁元素模組化更易維護整理 2
VUE-LOADER 優點 VUE 組件化 單一元素的 html, css, js 寫 在同個
Vue 組件。閱讀性 高、元素可拆分並重複利用。 <template>...</template> <script>...</script> <style>...</style> 組件內支援其他加載 在每個 Vue 組件內支持其他 的 Webpack 加載器。可依 喜愛加載語法。 <template lang="pug">... <script lang="typescript">.. <style lang="sass">... 資料綁定靈活 雙向、單向綁定皆可,父與子 元件不互相影響,單獨運作。 處理資料超方便,大量資料 也可自由搭配 Vuex。
Try out Demo Develop, Production
資料夾結構 https://github.com/Annilla/vue-cli-with-vs 3
資料夾結構
資料夾結構
資料夾結構
Webpack Configuration https://webpack.js.org/configuration/ 4
Webpack.config.js
Vue-loader https://vuejs.org/v2/guide/single-file-components.html#Introduction 5
Vue-loader
VS2017 環境設定 6
SETUP 1. 安裝 Node.js / 版本: 6 以上 ( 官網
) 2. 安裝擴充 NPM Task Runner (要執行npm 指令用) 3. 設定 Web Package Management (讓 VS 吃外部的 node 版本) 4. 詳細參見: OneNotes > Anny > Webpack
DEVELOP 開發步驟 7
DEVELOP 1. VS 開啟專案 > 開啟工作執行器總管 2. 執行 NPM Task
Runner > 點兩下執行 npm install 3. 執行 NPM Task Runner > 點兩下執行 Custom server 啟動 webpack-dev-server 4. 建置專案 > 啟動但不偵錯 > 修改 .vue 即可自動 reload 瀏覽器 注意:沒有被 webpack 監控的檔案不會因為修改而觸發 reload
PRODUCTION 產品步驟 8
PRODUCTION 1. 執行 NPM Task Runner > 點兩下執行 Custom build
2. 修改 Web.config <add key="UseWebpackDevServer" value="false"/> 3. 建置專案
“ Web.config 修改的差別在於 _Layout.cshtml 內 的 css, js 有用到這裡的值來判斷引入的路徑。 1.
Develop路徑: webpack-dev-server localhost:9000/... 2. Production路徑: /...
None
Syntax-highlighting ⊡ VScode: Vetur ⊡ VS2017: Vue.js Pack
REFERENCE ⊡ OneNote: 小組筆記本 > Anny > Webpack ⊡ Webpack
⊡ Vue ⊡ 想要了解更多嗎? 請密切關注 Team blog Webpack 3 tutorial 系列文章
THANKS! Any questions? By Anny Chang