Forráskód Böngészése

解决打包出错

zhuf 1 éve%!(EXTRA string=óta)
szülő
commit
84438f3ce4
4 módosított fájl, 2106 hozzáadás és 1904 törlés
  1. 2 1
      package.json
  2. 2095 1903
      pnpm-lock.yaml
  3. 1 0
      tsconfig.json
  4. 8 0
      vite.config.ts

+ 2 - 1
package.json

@@ -5,7 +5,7 @@
   "type": "module",
   "scripts": {
     "dev": "vite --host",
-    "build": "vue-tsc && vite build",
+    "build": "vite build",
     "preview": "vite preview"
   },
   "dependencies": {
@@ -30,6 +30,7 @@
     "unplugin-vue-components": "^0.25.2",
     "unplugin-vue-macros": "^2.6.2",
     "vite": "^5.0.8",
+    "vite-plugin-top-level-await": "^1.4.1",
     "vue-tsc": "^1.8.25"
   }
 }

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 2095 - 1903
pnpm-lock.yaml


+ 1 - 0
tsconfig.json

@@ -5,6 +5,7 @@
     "module": "ESNext",
     "lib": ["ES2020", "DOM", "DOM.Iterable"],
     "skipLibCheck": true,
+    "allowJs": true,
 
     /* Bundler mode */
     "moduleResolution": "bundler",

+ 8 - 0
vite.config.ts

@@ -10,6 +10,7 @@ import UnoCSS from 'unocss/vite'
 import VueMacros from 'unplugin-vue-macros/vite'
 import { VantResolver } from 'unplugin-vue-components/resolvers'
 import legacyPlugin from '@vitejs/plugin-legacy'
+import topLevelAwait from "vite-plugin-top-level-await";
 
 import basicSsl from '@vitejs/plugin-basic-ssl'
 export default defineConfig({
@@ -26,6 +27,13 @@ export default defineConfig({
   },
   plugins: [
     basicSsl(),
+    topLevelAwait({
+      // The export name of top-level await promise for each chunk module
+      promiseExportName: "__tla",
+      // The function to generate import names of top-level await promise in each chunk module
+      promiseImportName: i => `__tla_${i}`
+    }),
+
     legacyPlugin({
       targets: ['chrome 52'],  // 需要兼容的目标列表,可以设置多个
       additionalLegacyPolyfills: ['regenerator-runtime/runtime'] // 面向IE11时需要此插件