Vue / 前端WEB框架 / 筆記 · 2020-03-07

Vue webpack

安裝webpack (模板)

npm install webpack -g
(卸載 npm uninstall webpack -g)
vue init webpack my-project(專案名稱)

? Project name my-project(專案名稱)
? Project description A Vue.js project(專案描述) 
? Author xxx <xxx@xxx.com> (開發者) 
? Vue build standalone 
? Install vue-router? Yes 
? Use ESLint to lint your code? No 
? Set up unit tests No 
? Setup e2e tests with Nightwatch? No 
? Should we run `npm install` for you after the project has been created? (recommended) npm

// 1.(譯:運行+編譯:被推薦給大多數用戶)
> Runtime + Compiler:建議大多數用戶使用
// 2.(譯:只運行大約6KB比較輕量的壓縮文件,但只允許模板(或任何VUE特定HTML)。
//不准確,意思是選擇該構建方式對文件大小有要求)
>僅運行時:min + gzip輕約6KB,但僅模板(或任何Vue特定的HTML)
.vue文件中允許的渲染功能在其他位置是必需的

install vue-router?y
Use ESLint to lint your code?n
Setup unit tests? n
Setup e2e tests with Nightwatch(Y/n)?n
Should we run 'npm install' for you after the project has been created? yes use npm

cd my-project
sudo npm install
sudo npm run dev

連結  http://localhost:8080