fix(vite-plugins): 仅在生产环境构建时更新package.json

This commit is contained in:
feige996 2025-06-17 18:15:08 +08:00
parent 968a090876
commit c6d4a46968

View File

@ -7,6 +7,9 @@ const updatePackageJson = (): Plugin => {
return { return {
name: 'update-package-json', name: 'update-package-json',
async buildStart() { async buildStart() {
// 只在生产环境构建时执行
if (process.env.NODE_ENV !== 'production') return
const packageJsonPath = path.resolve(process.cwd(), 'package.json') const packageJsonPath = path.resolve(process.cwd(), 'package.json')
try { try {