Commit 76f126bb authored by 前端-许佳敏's avatar 前端-许佳敏

fix: 优化构建

parent c0819f70
......@@ -7,18 +7,25 @@
import { defineConfig } from 'umi';
import routes from './routes/index'
import proxy from './proxy'
import CaseSensitivePathsWebpackPlugins from 'case-sensitive-paths-webpack-plugin'
import theme from './theme.config'
import envValue from '../env'
import { setEnv, getEnv } from '../scripts/utils/envTool.js'
// 构建时带上的环境变量
const PRO_ENV = process.env.PRO_ENV
const PRO_ENV = process.env.PRO_ENV || ''
if (!PRO_ENV) {
throw `请传入PRO_ENV`
if (PRO_ENV) {
const envs = envValue[PRO_ENV]
if (envs) {
Object.keys(envs).forEach(key => {
process.env[key] = envs[key]
})
}
} else {
console.warn('未传入PRO_ENV, 如果是 yarn的时候出现 可以忽略')
}
setEnv(getEnv(envValue))
export default defineConfig({
title: '瓴犀平台后台',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment