diff --git a/.drone.yml b/.drone.yml index 1cb1624..23f4bb6 100644 --- a/.drone.yml +++ b/.drone.yml @@ -28,7 +28,7 @@ steps: - name: dev-build image: ccr.ccs.tencentyun.com/violin/node:22-bookworm commands: - - npm run build:h5 -- --mode development + - npm run build:h5 -- --mode production volumes: - name: node-cache path: /root/.npm diff --git a/.env.development b/.env.development index bf04d81..f14babb 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,3 @@ -# 开发环境 -VITE_API_BASE_URL=http://localhost:8080/api/v1 -VITE_H5_BASE_URL=http://localhost:8080 \ No newline at end of file +# 环境配置 +VITE_API_BASE_URL=https://sales.violin-work.online/api/v1 +VITE_H5_BASE_URL=https://sales.violin-work.online \ No newline at end of file diff --git a/.env.production b/.env.production index 1d7e24a..f14babb 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,3 @@ -# 生产环境 +# 环境配置 VITE_API_BASE_URL=https://sales.violin-work.online/api/v1 VITE_H5_BASE_URL=https://sales.violin-work.online \ No newline at end of file diff --git a/vite.config.js b/vite.config.js index 0b15f9a..64fac92 100644 --- a/vite.config.js +++ b/vite.config.js @@ -2,7 +2,6 @@ import { defineConfig, loadEnv } from 'vite' import uni from '@dcloudio/vite-plugin-uni' export default defineConfig(({ mode }) => { - // 加载当前环境的环境变量 const env = loadEnv(mode, process.cwd()) return { @@ -16,7 +15,6 @@ export default defineConfig(({ mode }) => { } }, define: { - // 注入环境变量到代码中 'import.meta.env.VITE_API_BASE_URL': JSON.stringify(env.VITE_API_BASE_URL || 'https://sales.violin-work.online/api/v1'), 'import.meta.env.VITE_H5_BASE_URL': JSON.stringify(env.VITE_H5_BASE_URL || 'https://sales.violin-work.online') }