Bläddra i källkod

fix: resolve antdv build warning

0xJacky 1 år sedan
förälder
incheckning
d1cbc72044
4 ändrade filer med 24 tillägg och 4 borttagningar
  1. 2 2
      app/package.json
  2. 1 1
      app/src/version.json
  3. 1 1
      app/version.json
  4. 20 0
      app/vite.config.ts

+ 2 - 2
app/package.json

@@ -41,16 +41,16 @@
     "xterm-addon-fit": "^0.8.0"
   },
   "devDependencies": {
+    "@antfu/eslint-config-vue": "^0.43.1",
     "@types/lodash": "^4.14.202",
     "@types/nprogress": "^0.2.0",
     "@types/sortablejs": "^1.15.0",
-    "@vue/tsconfig": "^0.4.0",
-    "@antfu/eslint-config-vue": "^0.43.1",
     "@typescript-eslint/eslint-plugin": "^6.13.0",
     "@typescript-eslint/parser": "^6.13.0",
     "@vitejs/plugin-vue": "^4.5.0",
     "@vitejs/plugin-vue-jsx": "^3.1.0",
     "@vue/compiler-sfc": "^3.3.10",
+    "@vue/tsconfig": "^0.4.0",
     "ace-builds": "^1.32.0",
     "autoprefixer": "^10.4.16",
     "eslint": "^8.54.0",

+ 1 - 1
app/src/version.json

@@ -1 +1 @@
-{"version":"2.0.0-beta.6","build_id":78,"total_build":282}
+{"version":"2.0.0-beta.6","build_id":92,"total_build":296}

+ 1 - 1
app/version.json

@@ -1 +1 @@
-{"version":"2.0.0-beta.6","build_id":78,"total_build":282}
+{"version":"2.0.0-beta.6","build_id":92,"total_build":296}

+ 20 - 0
app/vite.config.ts

@@ -10,6 +10,24 @@ import svgLoader from 'vite-svg-loader'
 import AutoImport from 'unplugin-auto-import/vite'
 import DefineOptions from 'unplugin-vue-define-options/vite'
 
+function fixAntdvWarningPlugin() {
+  return {
+    name: 'fix-antd-vue-warning', //
+    transform(code: string, id: string) {
+      // replace antdv js only
+      if (id.includes('ant-design-vue/es/_util/hooks/_vueuse')) {
+        // replace /* #__PURE__ */ with empty string
+        const newCode = code.replace(/\/\* #__PURE__ \*\//g, '')
+
+        return {
+          code: newCode,
+          map: null,
+        }
+      }
+    },
+  }
+}
+
 // https://vitejs.dev/config/
 export default defineConfig(({ mode }) => {
   // eslint-disable-next-line n/prefer-global/process
@@ -33,6 +51,8 @@ export default defineConfig(({ mode }) => {
       ],
     },
     plugins: [
+      fixAntdvWarningPlugin(),
+
       vue(),
       vueJsx(),