From 9af19370ac1332dbcea7d40f78c9b54beeac9344 Mon Sep 17 00:00:00 2001 From: czm <2192718639@qq.com> Date: Sun, 31 Jul 2022 14:54:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=8E=AF=E5=A2=83=E5=9F=9F?= =?UTF-8?q?=E5=90=8D=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/dev.js | 35 +++++++++++++++++++---------------- config/pre.js | 4 +++- config/prod.js | 4 +++- package.json | 3 ++- src/common/constant.js | 16 +++------------- 5 files changed, 30 insertions(+), 32 deletions(-) diff --git a/config/dev.js b/config/dev.js index ae97f48..e3a0d8a 100644 --- a/config/dev.js +++ b/config/dev.js @@ -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,28 +15,30 @@ module.exports = { plugin: { install: { plugin: require('terser-webpack-plugin'), - args: [{ - terserOptions: { - compress: true, // 默认使用terser压缩 - // compress: { - // drop_console: true, // 去掉打印 - // }, // 默认使用terser压缩 - // mangle: false, - keep_classnames: true, // 不改变class名称 - keep_fnames: true // 不改变函数名称 - } - }] - } - } + args: [ + { + terserOptions: { + compress: true, // 默认使用terser压缩 + // compress: { + // drop_console: true, // 去掉打印 + // }, // 默认使用terser压缩 + // mangle: false, + keep_classnames: true, // 不改变class名称 + 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' diff --git a/config/pre.js b/config/pre.js index a8791fb..232a1c5 100644 --- a/config/pre.js +++ b/config/pre.js @@ -3,7 +3,9 @@ module.exports = { env: { NODE_ENV: '"pre"', }, - defineConstants: {}, + defineConstants: { + CURRENT_BASE_URL: '"https://pre.zzfzyc.com/lymarket"', + }, mini: { optimizeMainPackage: { enable: true, diff --git a/config/prod.js b/config/prod.js index 6f57ab4..4e3a20d 100644 --- a/config/prod.js +++ b/config/prod.js @@ -3,7 +3,9 @@ module.exports = { env: { NODE_ENV: '"production"', }, - defineConstants: {}, + defineConstants: { + CURRENT_BASE_URL: '"https://www.zzfzyc.com/lymarket"', + }, mini: { optimizeMainPackage: { enable: true, diff --git a/package.json b/package.json index 07584a4..c738ea8 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/common/constant.js b/src/common/constant.js index 838f6ba..1a619a0 100644 --- a/src/common/constant.js +++ b/src/common/constant.js @@ -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 || ''}`