Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@metamask/snaps-webpack-plugin

Package Overview
Dependencies
Maintainers
11
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/snaps-webpack-plugin

  • 4.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
11
Created
Source

@metamask/snaps-webpack-plugin

A plugin for developing MetaMask Snaps using Webpack. 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-webpack-plugin
  • yarn add @metamask/snaps-webpack-plugin

Usage

Add the plugin to the plugins array in your Webpack configuration:

// webpack.config.js

import SnapsWebpackPlugin from '@metamask/snaps-webpack-plugin';

export default {
  plugins: [new SnapsWebpackPlugin(options)],
};

Options

All options are optional, and default to true.

import { Options } from '@metamask/snaps-webpack-plugin';

const options: Options = {
  /**
   * Whether to strip all comments from the bundle.
   */
  stripComments: true,

  /**
   * Whether to evaluate the bundle with SES, to ensure SES compatibility.
   */
  eval: true,

  /**
   * The path to the Snap manifest file. If set, it will be checked and automatically updated with
   * the bundle's hash, if `writeManifest` is enabled. Defaults to `snap/manifest.json` in the
   * current working directory.
   */
  manifestPath: './snap.manifest.json',

  /**
   * Whether to write the updated Snap manifest file to disk. If `manifestPath` is not set, this
   * option has no effect. If this is disabled, an error will be thrown if the manifest file is
   * invalid.
   */
  writeManifest: true,
};

Keywords

FAQs

Package last updated on 12 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc