Procházet zdrojové kódy

hdApp 1.uni-app 升级到最新版本(npx @dcloudio/uvm@latest) 2.其它依赖能升级的都升级,并打包升级到 webpack5

shizhongqi před 1 rokem
rodič
revize
11592883df
2 změnil soubory, kde provedl 108 přidání a 34 odebrání
  1. 57 34
      hdApp/package.json
  2. 51 0
      hdApp/vue.config.js

+ 57 - 34
hdApp/package.json

@@ -25,61 +25,84 @@
     "svgicon": "node ./src/uni_modules/zui-svg-icon/tools/generate-svg-icon.js"
   },
   "dependencies": {
-    "@dcloudio/uni-app-plus": "^2.0.2-3080420230530001",
-    "@dcloudio/uni-h5": "^2.0.0-25120200103006",
+    "@dcloudio/uni-app": "2.0.2-4070520250711001",
+    "@dcloudio/uni-app-plus": "2.0.2-4070520250711001",
+    "@dcloudio/uni-h5": "2.0.2-4070520250711001",
     "@dcloudio/uni-helper-json": "*",
-    "@dcloudio/uni-mp-alipay": "^2.0.0-25120200103006",
-    "@dcloudio/uni-mp-baidu": "^2.0.0-25120200103006",
-    "@dcloudio/uni-mp-qq": "^2.0.0-25120200103006",
-    "@dcloudio/uni-mp-toutiao": "^2.0.0-25120200103006",
-    "@dcloudio/uni-mp-weixin": "^2.0.2-3071120230427001",
-    "@dcloudio/uni-stat": "^2.0.0-25120200103006",
-    "autoprefixer": "^8.0.0",
-    "cache-loader": "^4.1.0",
+    "@dcloudio/uni-mp-360": "2.0.2-4070520250711001",
+    "@dcloudio/uni-mp-alipay": "2.0.2-4070520250711001",
+    "@dcloudio/uni-mp-baidu": "2.0.2-4070520250711001",
+    "@dcloudio/uni-mp-harmony": "2.0.2-4070520250711001",
+    "@dcloudio/uni-mp-jd": "2.0.2-4070520250711001",
+    "@dcloudio/uni-mp-kuaishou": "2.0.2-4070520250711001",
+    "@dcloudio/uni-mp-lark": "2.0.2-4070520250711001",
+    "@dcloudio/uni-mp-qq": "2.0.2-4070520250711001",
+    "@dcloudio/uni-mp-toutiao": "2.0.2-4070520250711001",
+    "@dcloudio/uni-mp-vue": "2.0.2-4070520250711001",
+    "@dcloudio/uni-mp-weixin": "2.0.2-4070520250711001",
+    "@dcloudio/uni-mp-xhs": "2.0.2-4070520250711001",
+    "@dcloudio/uni-quickapp-native": "2.0.2-4070520250711001",
+    "@dcloudio/uni-quickapp-webview": "2.0.2-4070520250711001",
+    "@dcloudio/uni-stacktracey": "2.0.2-4070520250711001",
+    "@dcloudio/uni-stat": "2.0.2-4070520250711001",
+    "@vue/shared": "3.5.18",
+    "autoprefixer": "^10.4.16",
     "echarts": "4.2.1",
-    "flyio": "^0.6.2",
+    "flyio": "0.6.14",
     "js-base64": "^2.5.1",
     "jweixin-module": "^1.4.1",
     "lodash": "^4.17.20",
-    "postcss": "^7.0.0",
-    "postcss-import": "^12.0.1",
+    "postcss": "^8.4.31",
+    "postcss-import": "^15.1.0",
     "regenerator-runtime": "^0.12.1",
     "text-encoding": "^0.7.0",
     "to-array-buffer": "^3.2.0",
     "vue": "^2.6.10",
     "vue-lazyload": "^1.3.3",
-    "vuex": "^3.0.1"
+    "vuex": "3.6.2"
   },
   "devDependencies": {
-    "@dcloudio/uni-automator": "^2.0.1-33920220121003",
-    "@dcloudio/uni-cli-i18n": "^2.0.1-33920220121003",
-    "@dcloudio/uni-cli-shared": "^2.0.1-33920220121003",
-    "@dcloudio/uni-i18n": "^2.0.1-32920211122003",
-    "@dcloudio/uni-migration": "^2.0.1-33920220121003",
-    "@dcloudio/uni-template-compiler": "^2.0.1-33920220121003",
-    "@dcloudio/vue-cli-plugin-hbuilderx": "^2.0.1-33920220121003",
-    "@dcloudio/vue-cli-plugin-uni": "^2.0.1-33920220121003",
-    "@dcloudio/webpack-uni-mp-loader": "^2.0.1-33920220121003",
-    "@dcloudio/webpack-uni-pages-loader": "^2.0.1-33920220121003",
+    "@dcloudio/uni-automator": "2.0.2-4070520250711001",
+    "@dcloudio/uni-cli-i18n": "2.0.2-4070520250711001",
+    "@dcloudio/uni-cli-shared": "2.0.2-4070520250711001",
+    "@dcloudio/uni-i18n": "2.0.2-4070520250711001",
+    "@dcloudio/uni-migration": "2.0.2-4070520250711001",
+    "@dcloudio/uni-template-compiler": "2.0.2-4070520250711001",
+    "@dcloudio/vue-cli-plugin-hbuilderx": "2.0.2-4070520250711001",
+    "@dcloudio/vue-cli-plugin-uni": "2.0.2-4070520250711001",
+    "@dcloudio/vue-cli-plugin-uni-optimize": "2.0.2-4070520250711001",
+    "@dcloudio/webpack-uni-mp-loader": "2.0.2-4070520250711001",
+    "@dcloudio/webpack-uni-pages-loader": "2.0.2-4070520250711001",
     "@types/html5plus": "*",
     "@types/uni-app": "*",
-    "@vue/cli-plugin-babel": "3.5.1",
-    "@vue/cli-service": "^4.1.0",
-    "babel-plugin-import": "^1.13.3",
-    "cross-env": "^7.0.3",
-    "jest": "^25.5.4",
+    "@vue/cli-plugin-babel": "~5.0.8",
+    "@vue/cli-service": "^5.0.8",
+    "assert": "^2.0.0",
+    "babel-plugin-import": "1.13.8",
+    "buffer": "^6.0.3",
+    "cross-env": "7.0.3",
+    "crypto-browserify": "^3.12.0",
+    "jest": "25.5.4",
     "mini-types": "*",
     "miniprogram-api-typings": "^2.8.0-2",
     "moment": "^2.24.0",
-    "postcss": "^7.0.0",
+    "path-browserify": "^1.0.1",
+    "postcss": "^8.4.31",
     "postcss-comment": "^2.0.0",
-    "postcss-import": "^12.0.1",
-    "postcss-loader": "~3.0.0",
+    "postcss-import": "^15.1.0",
+    "postcss-loader": "^8.1.1",
+    "process": "^0.11.10",
     "qs": "^6.8.0",
+    "querystring-es3": "^0.2.1",
     "sass": "1.32.13",
     "sass-migrator": "^1.7.3",
+    "stream-browserify": "^3.0.0",
     "svgo": "^4.0.0",
-    "vue-template-compiler": "^2.6.10"
+    "timers-browserify": "^2.0.12",
+    "url": "^0.11.3",
+    "util": "^0.12.5",
+    "vue-template-compiler": "^2.7.16",
+    "webpack": "^5.89.0"
   },
   "browserslist": [
     "Android >= 9",
@@ -88,4 +111,4 @@
   "uni-app": {
     "scripts": {}
   }
-}
+}

+ 51 - 0
hdApp/vue.config.js

@@ -1,2 +1,53 @@
 module.exports = {
+    configureWebpack: {
+        resolve: {
+            fallback: {
+                timers: require.resolve('timers-browserify'),
+                // webpack 5 需要的 Node.js polyfills
+                path: require.resolve('path-browserify'),
+                crypto: require.resolve('crypto-browserify'),
+                fs: false,
+                stream: require.resolve('stream-browserify'),
+                buffer: require.resolve('buffer'),
+                util: require.resolve('util'),
+                assert: require.resolve('assert'),
+                url: require.resolve('url'),
+                querystring: require.resolve('querystring-es3')
+            }
+        },
+        plugins: [
+            // 为 webpack 5 提供 Buffer polyfill
+            new (require('webpack')).ProvidePlugin({
+                Buffer: ['buffer', 'Buffer'],
+                process: 'process/browser'
+            })
+        ],
+        // 忽略一些不需要的模块
+        ignoreWarnings: [
+            {
+                module: /node_modules/,
+                message: /Can't resolve/
+            }
+        ]
+    },
+    chainWebpack: config => {
+        // 修复可能的 url-loader 配置问题
+        const staticTypes = ['images', 'media', 'fonts']
+        staticTypes.forEach(staticType => {
+            if (config.module.rules.has(staticType)) {
+                config.module.rule(staticType).uses.clear()
+                config.module
+                    .rule(staticType)
+                    .type('asset')
+                    .set('generator', {
+                        filename: `static/${staticType}/[name].[hash:8][ext]`
+                    })
+                    .set('parser', {
+                        dataUrlCondition: {
+                            maxSize: 4096
+                        }
+                    })
+            }
+        })
+    }
 }