5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-02 23:02:19 +08:00
wails/website/docs/guides/obfuscated.mdx
Misite Bao e9b2c15664
feat: optimize documentation website (#1849)
* fix(website): fix i18n configuration

* feat: add i18n file to auto generate code

* feat: move the crowdin configuration file to the website directory

* feat(website): add crowdin dependencies and scripts

* feat: add COC

* feat: use escape hatch syntax to wrap JSX code in MDX files

* feat: remove ach language

* feat: generate default language configuration

* feat: remove compare link

* feat: add COC link

* feat(website): update documentation

* feat: use escape hatch syntax to wrap JSX code in MDX files

* style: add prettier

* style: format mdx files

* chore: remove prettier command

* feat: update en docs

* feat: sync Chinese documents

* feat: update doc

* Update website/src/pages/coc.mdx

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
2022-09-18 22:01:50 +10:00

47 lines
1.4 KiB
Plaintext

# Obfuscated Builds
Wails includes support for obfuscating your application using [garble](https://github.com/burrowers/garble).
To produce an obfuscated build, you can use the `-obfuscate` flag with the `wails build` command:
```bash
wails build -obfuscate
```
To customise the obfuscation settings, you can use the `-garbleargs` flag:
```bash
wails build -obfuscate -garbleargs "-literals -tiny -seed=myrandomseed"
```
These settings may be persisted in your [project config](/guides/reference/project-config).
## How it works
In a standard build, all bound methods are available in the frontend under the `window.go`
variable. When these methods are called, the corresponding backend method is called using
the fully qualified function name. When using an obfuscated build, methods are bound using
an ID instead of a name. The bindings generated in the `wailsjs` directory use these IDs to
call the backend functions.
:::note
To ensure that your application will work in obfuscated mode, you must use the generated
bindings under the `wailsjs` directory in your application.
:::
## Example
Importing the "Greet" method from the bindings like this:
```js
import { Greet } from "../../wailsjs/go/main/App";
// snip
Greet("World");
```
will ensure that the method will work correctly in obfuscated mode, as the bindings will
be regenerated with IDs and the call mechanism updated.