Sfoglia il codice sorgente

chore(electron): modify electron packaging method to externalize static assets

dengdx 1 mese fa
parent
commit
a7cce23390
2 ha cambiato i file con 12 aggiunte e 3 eliminazioni
  1. 9 2
      electron-builder.json
  2. 3 1
      main.js

+ 9 - 2
electron-builder.json

@@ -3,12 +3,19 @@
   "productName": "dros",
   "electronVersion": "36.2.1",
 
-  "files": ["dist/h5/**/*", "main.js"],
+  "files": ["main.js"],
+  "extraFiles": [
+    {
+      "from": "dist/h5",
+      "to": "h5",
+      "filter": ["**/*"]
+    }
+  ],
   "win": {
     "target": [
       {
         "target": "portable",
-        "arch": ["x64", "ia32"]
+        "arch": ["x64"]
       }
     ]
   },

+ 3 - 1
main.js

@@ -23,7 +23,9 @@ function createWindow() {
   win.maximize();
 
   // 加载 Taro 编译后的 H5 页面
-  win.loadFile(path.join(__dirname, './dist/h5/index.html'));
+  // win.loadFile(path.join(__dirname, './dist/h5/index.html'));
+  // 加载外置 H5 页面
+  win.loadFile(path.join(process.cwd(), 'h5/index.html'));
 
   // 页面准备好再显示,防止视觉闪烁
   win.once('ready-to-show', () => win.show());