Skip to content

Commit 8dedd7d

Browse files
Document Snaps bundle analyzer option (#1955)
* Document Snaps bundle analyzer option * Apply suggestions from code review Co-authored-by: Maarten Zuidhoorn <[email protected]> * edits * add more context * clarify analyzer url --------- Co-authored-by: Maarten Zuidhoorn <[email protected]>
1 parent 111cc15 commit 8dedd7d

File tree

3 files changed

+31
-12
lines changed

3 files changed

+31
-12
lines changed

docs/whats-new.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ The latest major MetaMask documentation updates are listed by the month they wer
99
For a comprehensive list of recent product changes, visit the "Release Notes" section at the bottom
1010
of the [MetaMask developer page](https://metamask.io/developer/).
1111

12+
## April 2025
13+
14+
- Documented [Snaps bundle analyzer option](/snaps/reference/cli/subcommands/#analyze).
15+
([#1955](https://github.com/MetaMask/metamask-docs/pull/1955))
16+
1217
## March 2025
1318

1419
- Added a tutorial for [sending a transaction using Viem](/services/tutorials/ethereum/send-a-transaction/send-a-transaction-viem). ([#1920](https://github.com/MetaMask/metamask-docs/pull/1920))

snaps/learn/about-snaps/files.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,6 @@ built-ins must be bundled along with the Snap.
164164
Running `yarn start` bundles your Snap for you.
165165

166166
You can also run [`yarn mm-snap build`](../../reference/cli/subcommands.md#b-build) to bundle your
167-
Snap using [webpack](https://webpack.js.org/) or [Browserify](https://browserify.org).
167+
Snap using [webpack](https://webpack.js.org/).
168168
This command finds all dependencies using your specified main entry point and outputs a bundle
169169
file to your specified output path.

snaps/reference/cli/subcommands.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,27 @@ Builds a Snap from source.
2929

3030
`b` is an alias for `build`.
3131

32+
#### `analyze`
33+
34+
<Tabs>
35+
<TabItem value="Syntax">
36+
37+
```bash
38+
yarn mm-snap build --analyze
39+
```
40+
41+
</TabItem>
42+
</Tabs>
43+
44+
Enables analyzing the Snap [bundle](../../learn/about-snaps/files.md#bundle-file).
45+
This uses [`webpack-bundle-analyzer`](https://github.com/webpack-contrib/webpack-bundle-analyzer) under the hood,
46+
which creates an interactive visualization of the contents of your bundle.
47+
The visualization is located at the URL displayed in the command line output (for example, `http://localhost:8888`).
48+
49+
:::info
50+
This option requires [`@metamask/snaps-cli`](https://github.com/MetaMask/snaps/tree/main/packages/snaps-cli) version 6.7.0 or later.
51+
:::
52+
3253
#### `c`, `config`
3354

3455
<Tabs>
@@ -48,7 +69,8 @@ yarn mm-snap build --config ./snap.config.build.ts
4869
</TabItem>
4970
</Tabs>
5071

51-
Path to the [configuration file](../../learn/about-snaps/files.md#configuration-file).
72+
Path to the [configuration file](../../learn/about-snaps/files.md#configuration-file),
73+
which specifies [options](options.md) with which to the build the Snap.
5274

5375
`-c` is an alias for `--config`.
5476

@@ -79,21 +101,13 @@ Validates the Snap [manifest file](../../learn/about-snaps/files.md#manifest-fil
79101
<TabItem value="Syntax">
80102

81103
```bash
82-
yarn mm-snap manifest --fix <BOOLEAN>
83-
```
84-
85-
</TabItem>
86-
<TabItem value="Example">
87-
88-
```bash
89-
yarn mm-snap manifest --fix false
104+
yarn mm-snap manifest --fix
90105
```
91106

92107
</TabItem>
93108
</Tabs>
94109

95-
Enables or disables making any changes to fix the manifest file.
96-
The default is `true`.
110+
Enables making any changes to fix the manifest file.
97111

98112
### `s`, `serve`
99113

0 commit comments

Comments
 (0)