Skip to content

Document Snaps bundle analyzer option #1955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/whats-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ The latest major MetaMask documentation updates are listed by the month they wer
For a comprehensive list of recent product changes, visit the "Release Notes" section at the bottom
of the [MetaMask developer page](https://metamask.io/developer/).

## April 2025

- Documented [Snaps bundle analyzer option](/snaps/reference/cli/subcommands/#analyze).
([#1955](https://github.com/MetaMask/metamask-docs/pull/1955))

## March 2025

- 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))
Expand Down
2 changes: 1 addition & 1 deletion snaps/learn/about-snaps/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,6 @@ built-ins must be bundled along with the Snap.
Running `yarn start` bundles your Snap for you.

You can also run [`yarn mm-snap build`](../../reference/cli/subcommands.md#b-build) to bundle your
Snap using [webpack](https://webpack.js.org/) or [Browserify](https://browserify.org).
Snap using [webpack](https://webpack.js.org/).
This command finds all dependencies using your specified main entry point and outputs a bundle
file to your specified output path.
36 changes: 25 additions & 11 deletions snaps/reference/cli/subcommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,27 @@ Builds a Snap from source.

`b` is an alias for `build`.

#### `analyze`

<Tabs>
<TabItem value="Syntax">

```bash
yarn mm-snap build --analyze
```

</TabItem>
</Tabs>

Enables analyzing the Snap [bundle](../../learn/about-snaps/files.md#bundle-file).
This uses [`webpack-bundle-analyzer`](https://github.com/webpack-contrib/webpack-bundle-analyzer) under the hood,
which creates an interactive visualization of the contents of your bundle.
The visualization is located at the URL displayed in the command line output (for example, `http://localhost:8888`).

:::info
This option requires [`@metamask/snaps-cli`](https://github.com/MetaMask/snaps/tree/main/packages/snaps-cli) version 6.7.0 or later.
:::

#### `c`, `config`

<Tabs>
Expand All @@ -48,7 +69,8 @@ yarn mm-snap build --config ./snap.config.build.ts
</TabItem>
</Tabs>

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

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

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

```bash
yarn mm-snap manifest --fix <BOOLEAN>
```

</TabItem>
<TabItem value="Example">

```bash
yarn mm-snap manifest --fix false
yarn mm-snap manifest --fix
```

</TabItem>
</Tabs>

Enables or disables making any changes to fix the manifest file.
The default is `true`.
Enables making any changes to fix the manifest file.

### `s`, `serve`

Expand Down
Loading