@echo off set api=src\api\ if not exist %api%index.prod.js ( echo not exist production %api%index.prod.js echo Lack of API configuration file for online environments exit /b ) if not exist %api%index.js ( echo not exist production %api%index.js echo Lack of API configuration file for development environments exit /b ) :: 备份index.js copy %api%index.js %api%index.dev.js /y :: 重置index.js为线上环境 copy %api%index.prod.js %api%index.js /y npm run build:portal && copy %api%index.dev.js %api%index.js /y && echo Done