從零開始的Vue學習日誌 — 環境安裝part2

莊創偉
2 min readAug 13, 2019

用vue-cli建立專案成功運行後會看到預設頁面已經加了一堆有的沒的資訊,但是當點進去專案的index.html,會發現內容相當空洞,甚至連vue都沒有引用,頓時讓人不知從何下手。

相當空白的index頁

那這個網頁內容是怎麼渲染的出來的呢?

這就要談到webpack。webpack是一個打包軟體,幫助我們將寫好的程式封裝並發布成伺服器可以閱讀的檔案(.js、.css 等)。詳細介紹可以看官方文件(webpack介紹)

其中build/webpack.base.conf.js 是webpack的進入點。先打開來看看裡面的內容。

webpack.base.conf.js

可以看到進入點的路徑是./src/main.js

main.js

點進 main.js就看的到熟悉的vue語法了

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

莊創偉
莊創偉

Written by 莊創偉

學海無涯。但是為了生計還是得下海的風塵男子

No responses yet

Write a response