소스 검색

Add example of using allowlist to reduce binary size (#2111)

* Add example of using allowlist to reduce binary size

based on comment from@lucasfernog at https://discord.com/channels/616186924390023171/807549941936816148/859059694316683295

* fix example

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
Thad Guidry 4 년 전
부모
커밋
efefc6e6c1
1개의 변경된 파일25개의 추가작업 그리고 0개의 파일을 삭제
  1. 25 0
      docs/usage/guides/bundler/anti-bloat.md

+ 25 - 0
docs/usage/guides/bundler/anti-bloat.md

@@ -57,6 +57,31 @@ Binary size can easily be reduced by stripping out debugging information from bi
 
 See your local `strip` manpage for more information and flags that can be used to specify what information gets stripped out from the binary.
 
+### Allowlist config
+
+You can also reduce the application size with the `allowlist` config, and only enabling what you need. Sometimes this is useful with Tauri's [Bridge-Pattern](/docs/usage/patterns/bridge) or others, depending on needs.
+
+For example in `tauri.conf.json` file:
+
+```json
+{
+  "tauri": {
+    "allowlist": {
+      "all": false,
+      "fs": {
+        "writeFile": true,
+        "writeBinaryFile": true
+      },
+      "shell": {
+        "execute": true
+      },
+      "dialog": {
+        "save": true
+      }
+    }
+  }
+}
+```
 
 ### UPX