Socket
Socket
Sign inDemoInstall

speed-measure-webpack-plugin

Package Overview
Dependencies
0
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    speed-measure-webpack-plugin

Measure + analyse the speed of your webpack loaders and plugins


Version published
Weekly downloads
763K
decreased by-2.81%
Maintainers
1
Install size
194 kB
Created
Weekly downloads
 

Readme

Source

Speed Measure Plugin
(for webpack)


The first step to optimising your webpack build speed, is to know where to focus your attention.

This plugin measures your webpack build speed, giving an output like this:

Preview of Speed Measure Plugin's output

Install

npm install --save speed-measure-webpack-plugin

or

yarn add speed-measure-webpack-plugin

Usage

Change your webpack config from

const webpackConfig = {
  plugins: [
    new MyPlugin(),
    new MyOtherPlugin()
  ]
}

to

const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");

const webpackConfig = {
  plugins: SpeedMeasurePlugin.wrapPlugins({
    MyPlugin: new MyPlugin(),
    MyOtherPlugin: new MyOtherPlugin()
  })
}

If you're using webpack-merge, then you can do:

const smp = new SpeedMeasurePlugin();

const baseConfig = {
  plugins: smp.wrapPlugins({
    MyPlugin: new MyPlugin()
  }).concat(smp)
  // ^ note the `.concat(smp)`
};

const envSpecificConfig = {
  plugins: smp.wrapPlugins({
    MyOtherPlugin: new MyOtherPlugin()
  })
  // ^ note no `.concat(smp)`
}

const finalWebpackConfig = webpackMerge([
  baseConfig,
  envSpecificConfig
]);

Options

Options are passed in to the constructor

const smp = new SpeedMeasurePlugin(options);

or as the second argument to the static wrapPlugins

SpeedMeasurePlugin.wrapPlugins(pluginMap, options);

options.outputFormat

Type: String
Default: "human"

Determines in what format this plugin prints its measurements

  • "json" - produces a JSON blob
  • "human" - produces a human readable output

options.outputTarget

Type: String
Default: undefined

Specifies the path to a file to output to. If undefined, then output will print to console.log

options.disable

Type: Boolean
Default: false

If truthy, this plugin does nothing at all. It is recommended to set this with something similar to { disable: !process.env.MEASURE } to allow opt-in measurements with a MEASURE=true npm run build

FAQs

Last updated on 05 Feb 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc