优化环境域名切换

This commit is contained in:
czm 2022-07-31 14:54:34 +08:00
parent 19c266ed4f
commit 9af19370ac
5 changed files with 30 additions and 32 deletions

View File

@ -1,9 +1,10 @@
const path = require('path')
module.exports = {
env: {
NODE_ENV: '"development"'
NODE_ENV: '"development"',
},
defineConstants: {
CURRENT_BASE_URL: '"https://test.zzfzyc.com/lymarket"',
},
mini: {
// optimizeMainPackage: {
@ -14,7 +15,8 @@ module.exports = {
plugin: {
install: {
plugin: require('terser-webpack-plugin'),
args: [{
args: [
{
terserOptions: {
compress: true, // 默认使用terser压缩
// compress: {
@ -22,20 +24,21 @@ module.exports = {
// }, // 默认使用terser压缩
// mangle: false,
keep_classnames: true, // 不改变class名称
keep_fnames: true // 不改变函数名称
}
}]
}
}
keep_fnames: true, // 不改变函数名称
},
},
],
},
},
})
}
},
},
h5: {},
alias: {
'@': path.resolve(__dirname, '..', 'src'),
},
sass: {
resource: path.resolve(__dirname, '..', 'src/styles/common.scss')
resource: path.resolve(__dirname, '..', 'src/styles/common.scss'),
},
// plugins: [
// '@tarojs/plugin-react-devtools'

View File

@ -3,7 +3,9 @@ module.exports = {
env: {
NODE_ENV: '"pre"',
},
defineConstants: {},
defineConstants: {
CURRENT_BASE_URL: '"https://pre.zzfzyc.com/lymarket"',
},
mini: {
optimizeMainPackage: {
enable: true,

View File

@ -3,7 +3,9 @@ module.exports = {
env: {
NODE_ENV: '"production"',
},
defineConstants: {},
defineConstants: {
CURRENT_BASE_URL: '"https://www.zzfzyc.com/lymarket"',
},
mini: {
optimizeMainPackage: {
enable: true,

View File

@ -27,7 +27,8 @@
"dev:qq": "npm run build:qq -- --watch",
"dev:jd": "npm run build:jd -- --watch",
"dev:quickapp": "npm run build:quickapp -- --watch",
"build:weapp:pre": "cross-env NODE_ENV=pre taro build --type weapp"
"build:weapp:pre": "cross-env NODE_ENV=pre taro build --type weapp",
"dev:weapp:pre": "cross-env NODE_ENV=pre npm run build:weapp -- --watch"
},
"browserslist": [
"last 3 versions",

View File

@ -1,12 +1,4 @@
function BASE_URL_LIST() {
return {
development: `https://test.zzfzyc.com/lymarket`,
production: `https://www.zzfzyc.com/lymarket`,
pre: `https://pre.zzfzyc.com/lymarket`,
}[process.env.NODE_ENV || 'production']
}
export const BASE_URL = BASE_URL_LIST()
export const BASE_URL = CURRENT_BASE_URL
// export const BASE_URL = `http://192.168.0.75:50001/lymarket`
// export const BASE_URL = `http://192.168.0.89:50001/lymarket`
// export const BASE_URL = `http://10.0.0.5:50001/lymarket`
@ -29,12 +21,10 @@ export const GET_UPLOAD_SIGN = `/upyun/getsign` // 请求签名 url
export const UPLOAD_CDN_URL = `https://v0.api.upyun.com/`
// cdn
export const IMG_CND_Prefix = CURRENT_ENV.includes('development') ? 'https://test.cdn.zzfzyc.com' : 'https://cdn.zzfzyc.com'
// export const IMG_CND_Prefix = CURRENT_ENV.includes('development') ? 'https://test.cdn.zzfzyc.com' : 'https://www.cdn.zzfzyc.com'
export const IMG_CND_Prefix = CURRENT_ENV.includes('production') ? 'https://cdn.zzfzyc.com' : 'https://test.cdn.zzfzyc.com'
//在线支付图片baseUrl
export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_ENV.includes('development') ? 'https://test.zzfzyc.com' : 'https://www.zzfzyc.com'
// export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_ENV.includes('development') ? 'https://test.zzfzyc.com' : 'https://www.zzfzyc.com'
export const CAP_HTML_TO_IMAGE_BASE_URL = CURRENT_ENV.includes('production') ? 'https://www.zzfzyc.com' : 'https://test.zzfzyc.com'
// 上传图片视频
export const CDN_UPLOAD_IMG = `${UPLOAD_CDN_URL || ''}`