diff --git a/docs/whats-new.md b/docs/whats-new.md index 5394bd87651..4bff3255d1a 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -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)) diff --git a/snaps/learn/about-snaps/files.md b/snaps/learn/about-snaps/files.md index fc9eab02f1c..599bc4d3066 100644 --- a/snaps/learn/about-snaps/files.md +++ b/snaps/learn/about-snaps/files.md @@ -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. diff --git a/snaps/reference/cli/subcommands.md b/snaps/reference/cli/subcommands.md index 717dec526b2..2f56a5809ec 100644 --- a/snaps/reference/cli/subcommands.md +++ b/snaps/reference/cli/subcommands.md @@ -29,6 +29,27 @@ Builds a Snap from source. `b` is an alias for `build`. +#### `analyze` + + + + +```bash +yarn mm-snap build --analyze +``` + + + + +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` @@ -48,7 +69,8 @@ yarn mm-snap build --config ./snap.config.build.ts -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`. @@ -79,21 +101,13 @@ Validates the Snap [manifest file](../../learn/about-snaps/files.md#manifest-fil ```bash -yarn mm-snap manifest --fix -``` - - - - -```bash -yarn mm-snap manifest --fix false +yarn mm-snap manifest --fix ``` -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`