记一次 vue-cli-service 迁移至 vite 构建工具的过程
1. 为什么要迁移 当初项目创建之际正处于 vite 早期,不敢冒险尝试,现在 vite 版本更新到了 5.x ,而且有着比 vue-cli-service(基于 webpack)好得多的性能,构建速度更快,热更新支持更完善,所以有什么理由不迁移呢。 2. 迁移 2.1 移除 vue-cli-service 相关依赖 现有 package.json 内容如下: { "name": "sfarm-front-vue", "version": "1.0.0", "private": true, "scripts": { "serve": "vue-cli-service --mode development serve", "build": "vue-cli-service build", "build:test": "vue-cli-service --mode development build", "lint": "vue-cli-service lint", "start": "yarn serve", "start:local": "vue-cli-service --mode local serve", "start:prod": "vue-cli-service --mode production serve", "prepare": "husky install" }, "dependencies": { "@element-plus/icons-vue": "^1.1.4", "axios": "^0.24.0", "core-js": "^3.6.5", "echarts": "^5....