JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 831694
  • Score
    100M100P100Q198008F
  • License ISC

Measure + analyse the speed of your webpack loaders and plugins

Package Exports

  • speed-measure-webpack-plugin

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (speed-measure-webpack-plugin) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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|Function
Default: "human"

Determines in what format this plugin prints its measurements

  • "json" - produces a JSON blob
  • "human" - produces a human readable output
  • "humanVerbose" - produces a more verbose version of the human readable output
  • If a function, it will call the function with the JSON blob being the first parameter, and just the response of the function as the output

options.outputTarget

Type: String|Function
Default: console.log

  • If a string, it specifies the path to a file to output to.
  • If a function, it will call the function with the output as the first parameter

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