lanjianrong 5 年 前
コミット
92281ba233
4 ファイル変更4 行追加10 行削除
  1. 1 1
      config/config.js
  2. 1 1
      package.json
  3. 2 1
      src/basic/utils/request.js
  4. 0 7
      src/layouts/BasicLayout.jsx

+ 1 - 1
config/config.js

@@ -107,7 +107,7 @@ export default defineConfig({
           // filename: 文件名称,这里我们不设置,让它保持和未压缩的文件同一个名称
           algorithm: 'gzip', // 指定生成gzip格式
           test: new RegExp('\\.(' + prodGzipList.join('|') + ')$'), // 匹配哪些格式文件需要压缩
-          threshold: 1024, //对超过10k的数据进行压缩
+          threshold: 5000, //对超过10k的数据进行压缩
           minRatio: 0.6 // 压缩比例,值为0 ~ 1
         })
       )

+ 1 - 1
package.json

@@ -5,7 +5,7 @@
   "description": "An out-of-box UI solution for enterprise applications",
   "scripts": {
     "analyze": "cross-env ANALYZE=1 umi build",
-    "build": "umi build",
+    "build": "cross-env REACT_APP_ENV=prod umi build",
     "deploy:qa": "auto-deploy build -t qa",
     "deploy:prod": "auto-deploy build -t prod",
     "deploy-gh-pages": "npm run site && npm run gh-pages",

+ 2 - 1
src/basic/utils/request.js

@@ -58,7 +58,8 @@ const request = extend({
   errorHandler,
   // 默认错误处理
   credentials: 'include', // 默认请求是否带上cookie
-  prefix: consts.PREFIX_URL
+  prefix: consts.PREFIX_URL,
+  cache: 'no-cache'
 })
 
 /**

+ 0 - 7
src/layouts/BasicLayout.jsx

@@ -47,13 +47,6 @@ const BasicLayout = props => {
     route: routeForAuthorized
   } = props
   const menuDataRef = useRef([])
-  // useEffect(() => {
-  //   if (dispatch) {
-  //     dispatch({
-  //       type: 'user/fetchCurrent'
-  //     })
-  //   }
-  // }, [])
   /**
    * init variables
    */