跳到主要內容

發表文章

目前顯示的是有「Vite」標籤的文章

vite編譯typescript時發生錯誤 Property 'xxx' does not exist on type

從vue/cli改為vite時,首先遇到 Property 'xxx' does not exist on type ,這種很鳥的錯誤,不知道為什麼沒找到很好的解法,但我就先把package.json裡的 "build": "vue-tsc --noEmit  && vite build" 直接改成  "build": "vite build" ,等正式發行 vite 3.0時應該這些設定檔都會校調好吧?

2021年使用Vite開發Vue 3網頁

尤雨溪開發的產品特色就是執行速度很快 Vite 的速度也是飛快,但前端技術一直在改變,若不使用正確的方式,光是node modules相依性就處理不完,特此紀錄現在2021年的vite用法。 以前是create-vite-app,現在改為 yarn create @vitejs/app  ,更快的方法是輸入  yarn create @vitejs/app 目錄名 或是 yarn create @vitejs/app 目錄名 --template vue-ts   註:現在vue 3相容性還是偶有問題,像我 vue add bootstrap 之後,會造成 yarn build 出錯 所以要把package.json裡 "build": "vuedx-typecheck . && vite build"改成"build": "vite build" 如果發現使用TypeScript出現以下錯誤: 就在專案根目錄增加一個shims-vue.d.ts declare module '*.vue' { import type {DefineComponent, defineComponent} from 'vue'; const component: DefineComponent export default component; } 就可以看到 如果還有問題,就是要調整其他的設定,待補...