vue3 + vite 報錯處理

TypeError: vite.defineConfig is not a function

執行命令:npm install @vitejs/plugin-vue -D 

config裏面配置代碼:

import vue from '@vitejs/plugin-vue'

export default defineConfig({
  plugins: [vue()]
})

配置完,會有如下報錯:TypeError: vite.createFilter is not a function

原因:vite插件與vite版本不一致

1、升級vite版本執行命令:npm install -D vite@^3

2、降低插件版本:npm i @vitejs/[email protected]

 

安裝最新的vue cli npm install -g @vue/cli

yarn global add @vue/cli

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章