@metamask/snaps-browserify-plugin
A plugin for developing MetaMask Snaps using Browserify. This can be used as alternative to the mm-snap
CLI build
command. It transforms the bundle to fix common issues with SES. For a list of changes the plugin makes, you can refer to the source code.
Installation
Use Node.js 16.0.0
or later. We recommend using nvm for managing Node.js versions.
Install a dependency in your snap project using yarn
or npm
:
npm install @metamask/snaps-browserify-plugin
yarn add @metamask/snaps-browserify-plugin
Usage
import browserify from 'browserify';
const bundle = browserify();
bundle.plugin('@metamask/snaps-browserify-plugin', options);
Options
All options are optional, and default to true
.
import { Options } from '@metamask/snaps-browserify-plugin';
const options: Options = {
stripComments: true,
eval: true,
manifestPath: './snap.manifest.json',
writeManifest: true,
};