lilei 2 éve
szülő
commit
dc7b46f972
2 módosított fájl, 39 hozzáadás és 39 törlés
  1. 1 1
      public/version.json
  2. 38 38
      vue.config.js

+ 1 - 1
public/version.json

@@ -1,5 +1,5 @@
 {
   "message": "发现有新版本发布,确定更新系统?",
   "vendorJsVersion": "",
-  "version": 1677138747105
+  "version": 1677138925220
 }

+ 38 - 38
vue.config.js

@@ -2,11 +2,11 @@ const fs = require('fs');
 const path = require('path')
 const webpack = require('webpack')
 const createThemeColorReplacerPlugin = require('./config/plugin.config')
-// gzip ѹ��
+// gzip 压缩
 const compressionWebpackPlugin = require('compression-webpack-plugin');
-// js,css ѹ��
+// js,css 压缩
 const TerserPlugin = require('terser-webpack-plugin');
-// �汾�Զ�����
+// 版本自动生成
 const WebpackVersionPlugin = require('webpack-version-plugin');
 const versionConfig = require(resolve('public/version.json'));
 
@@ -22,13 +22,13 @@ function isProd () {
   return process.env.NODE_ENV === 'production'
 }
 
-// ��Ŀ������ᅣ1�7
-// Ĭ������£����Ǽ������Ӧ�ý�����������ĸ�Ŀ¼�ᅣ1�7
-// ���磺https://www.my-app.com/
-// Ĭ�ϣ�'/'
-// �������Ӧ�ó���������·���У�����Ҫ����ָ����·�ᅣ1�7
-// ���磺https://www.foobar.com/my-app/
-// ��Ҫ������Ϊ'/my-app/'
+// 项目部署基础
+// 默认情况下,我们假设你的应用将被部署在域的根目录下,
+// 例如:https://www.my-app.com/
+// 默认:'/'
+// 如果您的应用程序部署在子路径中,则需要在这指定子路径
+// 例如:https://www.foobar.com/my-app/
+// 需要将它改为'/my-app/'
 const BASE_URL = isProd ? '/' : '/'
 
 const assetsCDN = {
@@ -61,21 +61,21 @@ const prodExternals = {
 
 // vue.config.js
 const vueConfig = {
-  runtimeCompiler: true, // ��̬������ᅣ1�7
+  runtimeCompiler: true, // 动态编译组件
   publicPath: BASE_URL,
   configureWebpack: {
     optimization: isProd() ? {
           minimize: true,
           minimizer: [new TerserPlugin({
-              test: /\.js(\?.*)?$/i,    //ƥ�����ѹ�����ļᅣ1�7
-              parallel: true,    //ʹ�ö���̲������ᅣ1�7
-              terserOptions: {    //Terser ѹ������
+              test: /\.js(\?.*)?$/i,    //匹配参与压缩的文件
+              parallel: true,    //使用多进程并发运行
+              terserOptions: {    //Terser 压缩配置
                   output:{comments: false},
-                  compress: {//consoleɾ��
+                  compress: {//console删除
                       pure_funcs: ["console.log"]
                   }
               },
-              extractComments: true,    //��ע�Ͱ��뵽�������ļ���
+              extractComments: true,    //将注释剥离到单独的文件中
           })],
       }:{},
     // webpack plugins
@@ -83,15 +83,15 @@ const vueConfig = {
       // Ignore all locale files of moment.js
       new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
       new compressionWebpackPlugin({
-          //[file] �ᱻ�滻��ԭʼ��Դ��[path] �ᱻ�滻��ԭʼ��Դ��·���� [query] �ᱻ�滻�ɲ�ѯ�ַ�����Ĭ��ֵ�� "[path].gz[query]"��
-          filename: '[path].gz[query]', // ��ʾcompression-webpack-plugin@3.0.0�Ļ�asset��Ϊfilename
-          //������ function(buf, callback) �����ַ����������ַ�����˵���� zlib ���㷨(���� zopfli ���㷨)��Ĭ��ֵ�� "gzip"��
+          //[file] 会被替换成原始资源。[path] 会被替换成原始资源的路径, [query] 会被替换成查询字符串。默认值是 "[path].gz[query]"。
+          filename: '[path].gz[query]', // 提示compression-webpack-plugin@3.0.0的话asset改为filename
+          //可以是 function(buf, callback) 或者字符串。对于字符串来说依照 zlib 的算法(或者 zopfli 的算法)。默认值是 "gzip"。
           algorithm: 'gzip',
-          //����ƥ����������Դ���ᱻ������Ĭ��ֵ��ȫ����Դ��
+          //所有匹配该正则的资源都会被处理。默认值是全部资源。
           test: new RegExp('\\.(' + ['js', 'css'].join('|') + ')$'),
-          //ֻ�д�С���ڸ�ֵ����Դ�ᱻ��������λ�� bytes��Ĭ��ֵ�� 0��
+          //只有大小大于该值的资源会被处理。单位是 bytes。默认值是 0。
           threshold: 10240,
-          //ֻ��ѹ����С�����ֵ����Դ�Żᱻ������Ĭ��ֵ�ᅣ1�70.8��
+          //只有压缩率小于这个值的资源才会被处理。默认值是 0.8。
           minRatio: 0.8
         }),
       new WebpackVersionPlugin({
@@ -137,17 +137,17 @@ const vueConfig = {
     }
     
     config.optimization && config.optimization.splitChunks({
-        // ������ᅣ1�7
-        chunks: 'all', //��ѡһ��"initial" ��ʼ����"all"(Ĭ�Ͼ���all)��"async"����̬���أ� 
-        minSize: 30000, // �γ�һ���´������С�����,ֻ�� >= minSize ��bundle�ᱻ��ֳ��ᅣ1�730000
-        maxSize: 0, //���֮ǰ������ֵ��Ĭ��΄1�7������������
-        minChunks: 1, //������������Ϊ2 ��ôһ����Դ���ٱ��������βſ��Ա���ֳ��ᅣ1�7
-        maxAsyncRequests: 5, // ������ص������������
-        maxInitialRequests: 4, // һ����������������
-        automaticNameDelimiter: '~', // �ļ��������ӷ�
+        // 拆包配置 
+        chunks: 'all', //三选一:"initial" 初始化,"all"(默认就是all),"async"(动态加载) 
+        minSize: 30000, // 形成一个新代码块最小的体积,只有 >= minSize 的bundle会被拆分出来 30000
+        maxSize: 0, //拆分之前最大的数值,默认为0,即不做限制
+        minChunks: 1, //引入次数,如果为2 那么一个资源最少被引用两次才可以被拆分出来
+        maxAsyncRequests: 5, // 按需加载的最大并行请求数
+        maxInitialRequests: 4, // 一个入口最大并行请求数
+        automaticNameDelimiter: '~', // 文件名的连接符
         name: true,
         cacheGroups: {
-        // node_modulesģ��ᅣ1�7
+        // node_modules模块包
         vendors: {
           test: /[\\/]node_modules[\\/]/,
           name: 'chunk-vendors',
@@ -158,7 +158,7 @@ const vueConfig = {
           chunks: 'all',
           priority: -10,
         },
-        // UI�ⵥ����ᅣ1�7
+        // UI库单独拆包
         antDesign: {
           name: 'chunk-antDesign',
           priority: 19, //  the weight needs to be larger than libs and app or it will be packaged into libs or app
@@ -169,18 +169,18 @@ const vueConfig = {
           priority: 20, //  the weight needs to be larger than libs and app or it will be packaged into libs or app
           test: /[\\/]node_modules[\\/]_?ant-design-vue(.*)/
         },
-        // �����
+        // 共享模块
         common: {
           name: 'chunk-common',
           minChunks: 2,
-          maxSize: 1024, //���֮ǰ������ֵ��Ĭ��΄1�7������������
+          maxSize: 1024, //拆分之前最大的数值,默认为0,即不做限制
           priority: -20,
           reuseExistingChunk: true
         }
         }
     });
     
-    // ���������Є1�7
+    // 分析打包大小
     if (process.env.npm_config_report) {
       config.plugin('webpack-bundle-analyzer')
       .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
@@ -193,7 +193,7 @@ const vueConfig = {
     loaderOptions: {
       less: {
         modifyVars: {
-          // less vars,customize ant design theme
+          // less vars锛宑ustomize ant design theme
           'primary-color': process.env.VUE_APP_THEME_COLOR,
           'link-color': process.env.VUE_APP_THEME_COLOR
           // 'border-radius-base': '4px'
@@ -211,7 +211,7 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
       '/api': {
-        // target: 'http://192.168.0.216:8076/qpls-md',
+        // target: 'http://192.168.0.183:8503/qpls-md',
         target: 'http://p.iscm.360arrow.com/qpls-md',
         // ws: false,
         ws: true,
@@ -241,4 +241,4 @@ if (process.env.VUE_APP_PREVIEW === 'true') {
   vueConfig.configureWebpack.plugins.push(createThemeColorReplacerPlugin())
 }
 
-module.exports = vueConfig
+module.exports = vueConfig