dusenyao 2 éve
szülő
commit
debd42fa9e
4 módosított fájl, 1646 hozzáadás és 1193 törlés
  1. 1 8
      .eslintrc.js
  2. 1572 1144
      package-lock.json
  3. 26 23
      package.json
  4. 47 18
      vue.config.js

+ 1 - 8
.eslintrc.js

@@ -210,13 +210,7 @@ module.exports = {
     'template-curly-spacing': [2, 'never'],
     'wrap-iife': [2, 'any'],
     'yield-star-spacing': [2, 'both'],
-    'object-curly-spacing': [
-      2,
-      'always',
-      {
-        objectsInObjects: false
-      }
-    ],
+    'object-curly-spacing': [2, 'always'],
     'no-alert': process.env.NODE_ENV === 'production' ? 1 : 0,
     'no-array-constructor': 2,
     'no-bitwise': 1,
@@ -240,7 +234,6 @@ module.exports = {
     'no-label-var': 2,
     'no-lone-blocks': 2,
     'no-lonely-if': 2,
-    'no-loop-func': 1,
     'linebreak-style': [0, 'windows'],
     'no-multi-str': 2,
     'no-nested-ternary': 0,

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1572 - 1144
package-lock.json


+ 26 - 23
package.json

@@ -11,51 +11,54 @@
   },
   "dependencies": {
     "axios": "^0.27.2",
-    "core-js": "^3.23.3",
-    "element-ui": "^2.15.9",
+    "core-js": "^3.25.1",
+    "element-ui": "2.15.8",
     "js-cookie": "^3.0.1",
     "md5": "^2.3.0",
     "normalize.css": "^8.0.1",
     "nprogress": "^0.2.0",
-    "vue": "^2.6.14",
-    "vue-router": "^3.5.4",
+    "vue": "^2.7.10",
+    "vue-router": "^3.6.3",
     "vuex": "^3.6.2"
   },
   "devDependencies": {
-    "@babel/core": "^7.18.5",
-    "@babel/eslint-parser": "^7.18.2",
-    "@rushstack/eslint-patch": "^1.1.3",
-    "@vue/cli-plugin-babel": "~4.5.18",
-    "@vue/cli-plugin-eslint": "~4.5.18",
-    "@vue/cli-plugin-router": "~4.5.18",
-    "@vue/cli-plugin-unit-jest": "^4.5.18",
-    "@vue/cli-plugin-vuex": "~4.5.18",
-    "@vue/cli-service": "~4.5.18",
+    "@babel/core": "^7.18.13",
+    "@babel/eslint-parser": "^7.18.9",
+    "@rushstack/eslint-patch": "^1.1.4",
+    "@vue/cli-plugin-babel": "~5.0.8",
+    "@vue/cli-plugin-eslint": "~5.0.8",
+    "@vue/cli-plugin-router": "~5.0.8",
+    "@vue/cli-plugin-unit-jest": "^5.0.8",
+    "@vue/cli-plugin-vuex": "~5.0.8",
+    "@vue/cli-service": "~5.0.8",
     "@vue/eslint-config-prettier": "^7.0.0",
+    "@vue/preload-webpack-plugin": "^2.0.0",
     "@vue/test-utils": "^1.3.0",
     "babel-jest": "^27.5.1",
     "babel-plugin-dynamic-import-node": "^2.3.3",
+    "compression-webpack-plugin": "^6.1.1",
     "eslint": "^7.32.0",
-    "eslint-plugin-prettier": "^4.0.0",
-    "eslint-plugin-vue": "^9.1.1",
+    "eslint-plugin-prettier": "^4.2.1",
+    "eslint-plugin-vue": "^9.4.0",
     "html-webpack-plugin": "^5.5.0",
-    "postcss": "^8.4.14",
-    "postcss-html": "^1.4.1",
+    "postcss": "^8.4.16",
+    "postcss-html": "^1.5.0",
     "prettier": "2.7.1",
-    "sass": "^1.53.0",
-    "sass-loader": "^10.2.1",
+    "sass": "^1.54.9",
+    "sass-loader": "^10.3.1",
     "script-ext-html-webpack-plugin": "^2.1.5",
-    "stylelint": "^14.9.1",
+    "stylelint": "^14.11.0",
     "stylelint-config-prettier": "^9.0.3",
     "stylelint-config-recess-order": "^3.0.0",
     "stylelint-config-recommended-vue": "^1.4.0",
-    "stylelint-config-standard-scss": "^4.0.0",
+    "stylelint-config-standard-scss": "^5.0.0",
     "stylelint-declaration-block-no-ignored-properties": "^2.5.0",
     "stylelint-webpack-plugin": "^3.3.0",
     "svg-sprite-loader": "^6.0.11",
     "svgo": "^2.8.0",
-    "vue-loader": "^15.9.8",
-    "vue-template-compiler": "^2.6.14"
+    "vue-loader": "^15.10.0",
+    "vue-template-compiler": "^2.7.10",
+    "vue-demi": "^0.13.11"
   },
   "browserslist": [
     "> 1%",

+ 47 - 18
vue.config.js

@@ -1,5 +1,7 @@
 const path = require('path');
 const StyleLintPlugin = require('stylelint-webpack-plugin');
+const CompressionPlugin = require('compression-webpack-plugin');
+const PreloadPlugin = require('@vue/preload-webpack-plugin');
 
 function resolve(dir) {
   return path.join(__dirname, './', dir);
@@ -16,6 +18,7 @@ let proxy = {};
 if (NODE_ENV === 'development') {
   proxy = {
     [process.env.VUE_APP_BASE_API]: {
+      // target: 'https://gcls.utschool.cn/',
       target: 'https://gcls.helxsoft.cn/',
       changeOrigin: true,
       pathRewrite: {
@@ -35,10 +38,15 @@ module.exports = {
   productionSourceMap: false,
   devServer: {
     port,
-    open: true, // 默认false true自动打开网页
-    overlay: {
-      warnings: false,
-      errors: true
+    // 自动打开目标网页
+    open: {
+      target: [`http://localhost:${port}`]
+    },
+    client: {
+      overlay: {
+        warnings: false,
+        errors: true
+      }
     },
     proxy
   },
@@ -59,29 +67,50 @@ module.exports = {
       }
     },
     devtool: NODE_ENV === 'development' ? 'source-map' : '',
-    // stylelint 配置
     plugins: [
+      // stylelint 配置
       new StyleLintPlugin({
-        files: ['**/*.{vue,htm,html,css,sss,less,scss,sass}'],
+        files: ['src/**/*.{vue,html,css,scss}'],
         fix: true, // 是否自动修复
-        cache: true // 是否缓存
+        failOnError: false
+      }),
+      new CompressionPlugin({
+        algorithm: 'gzip', // 使用gzip压缩
+        test: /\.js$|\.html$|\.css$/, // 匹配文件名
+        minRatio: 0.8, // 压缩率小于0.8才会压缩
+        threshold: 10240, // 对超过10k的数据压缩
+        deleteOriginalAssets: false // 是否删除未压缩的源文件,谨慎设置,如果希望提供非gzip的资源,可不设置或者设置为false(比如删除打包后的gz后还可以加载到原始资源文件)
       })
     ]
   },
   chainWebpack(config) {
     // 启用预加载,提高首屏加载速度
-    config.plugin('preload').tap(() => [
-      {
-        rel: 'preload',
-        // 忽略 runtime.js
-        // https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/cli-service/lib/config/app.js#L171
-        fileBlacklist: [/\.map$/, /hot-update\.js$/, /runtime\..*\.js$/],
-        include: 'initial'
-      }
-    ]);
+    config
+      .plugin('preload')
+      .use(PreloadPlugin, [
+        {
+          rel: 'preload',
+          include: 'initial',
+          fileBlacklist: [/\.map$/, /hot-update\.js$/],
+          as(entry) {
+            if (/\.css$/.test(entry)) return 'style';
+
+            return 'script';
+          }
+        }
+      ])
+      .after('html');
 
     // 当页面很多时,prefetch 将导致太多无意义的请求,开启这个
-    // config.plugins.delete('prefetch');
+    config
+      .plugin('prefetch')
+      .use(PreloadPlugin, [
+        {
+          rel: 'prefetch',
+          include: 'asyncChunks'
+        }
+      ])
+      .after('html');
 
     // 设置 svg-sprite-loader
     config.module.rule('svg').exclude.add(resolve('src/icons')).end();
@@ -133,7 +162,7 @@ module.exports = {
         }
       });
 
-      // https:// webpack.js.org/configuration/optimization/#optimizationruntimechunk
+      // https://webpack.js.org/configuration/optimization/#optimizationruntimechunk
       config.optimization.runtimeChunk('single');
     });
   }

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott