Przeglądaj źródła

优化打包问题

xiongxing 1 tydzień temu
rodzic
commit
a8d34c1fdb
3 zmienionych plików z 268 dodań i 186 usunięć
  1. 2 1
      package.json
  2. 238 185
      pnpm-lock.yaml
  3. 28 0
      scripts/fix-vue-office.js

+ 2 - 1
package.json

@@ -24,7 +24,8 @@
     "lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src",
     "lint:format": "prettier --write --loglevel warn \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"",
     "lint:style": "stylelint --fix \"./src/**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
-    "lint:lint-staged": "lint-staged -c "
+    "lint:lint-staged": "lint-staged -c ",
+    "postinstall": "node scripts/fix-vue-office.js"
   },
   "dependencies": {
     "@element-plus/icons-vue": "^2.1.0",

Plik diff jest za duży
+ 238 - 185
pnpm-lock.yaml


+ 28 - 0
scripts/fix-vue-office.js

@@ -0,0 +1,28 @@
+const fs = require('fs')
+const path = require('path')
+
+const packages = ['@vue-office/excel', '@vue-office/docx', '@vue-office/pptx']
+
+packages.forEach((pkg) => {
+  const pkgDir = path.resolve(__dirname, '..', 'node_modules', pkg)
+  const v3Dir = path.join(pkgDir, 'lib', 'v3')
+  const libDir = path.join(pkgDir, 'lib')
+
+  if (!fs.existsSync(v3Dir)) {
+    console.warn(`[fix-vue-office] v3 dir not found: ${v3Dir}`)
+    return
+  }
+
+  // 复制 v3 下所有 .js 和 .css 文件到 lib 目录
+  const files = fs.readdirSync(v3Dir)
+  files.forEach((file) => {
+    if (file.endsWith('.js') || file.endsWith('.css')) {
+      const src = path.join(v3Dir, file)
+      const dest = path.join(libDir, file)
+      if (!fs.existsSync(dest)) {
+        fs.copyFileSync(src, dest)
+        console.log(`[fix-vue-office] Fixed: ${pkg} (lib/v3/${file} → lib/${file})`)
+      }
+    }
+  })
+})

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików