fix(boilerplate): create Vue apps with Vite #514
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
因为 @vue/cli 已经进入 Maintenance Mode 了,所以我试着把通过
lean new
创建 Vue 项目的工具换成了 create-vite。但现在遇到了一个小问题,就是由于以下这三种情况同时存在,导致如果开发者直接把通过 create-vite 创建的项目使用lean deploy
进行部署(而不预先手动执行一次npm install
),会遇到因为云端环境缺少 vite 这一依赖而无法构建的错误:devDependencies
;npm install
,所以项目中默认只有 package.json,不会有 package-lock.json;npm install --production
安装依赖,这意味着devDependencies
中的依赖不会被安装。如果我们假定多数开发者创建项目后会在部署之前自己执行一次
npm install
(事实上 create-vite 创建好项目后会引导开发者手动运行一次npm install
),那么我们可能就不用太在意这个问题了。可能会存在少数开发者在创建项目后什么都不做就直接部署,但我不确定这部分开发者会有多少。我推测一部分开发者可能会因为想在开始开发项目之前先测试一下云引擎的部署功能所以这么做。一些可能的解决方案:
npm install
。npm install
安装依赖,而非npm install --production
。