All Projects → stephencookdev → Speed Measure Webpack Plugin

stephencookdev / Speed Measure Webpack Plugin

Licence: mit
⏱ See how fast (or not) your plugins and loaders are, so you can optimise your builds

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Speed Measure Webpack Plugin

Prepack Webpack Plugin
A webpack plugin for prepack.
Stars: ✭ 1,054 (-46.77%)
Mutual labels:  webpack, plugin
Cypress Webpack Preprocessor
Cypress preprocessor for bundling JavaScript via webpack
Stars: ✭ 93 (-95.3%)
Mutual labels:  webpack, plugin
Craco Alias
A craco plugin for automatic aliases generation for Webpack and Jest
Stars: ✭ 56 (-97.17%)
Mutual labels:  webpack, plugin
Feflow
🚀 A command line tool aims to improve front-end engineer workflow and standard, powered by TypeScript.
Stars: ✭ 942 (-52.42%)
Mutual labels:  webpack, plugin
Sounds Webpack Plugin
🔊Notify or errors, warnings, etc with sounds
Stars: ✭ 125 (-93.69%)
Mutual labels:  webpack, plugin
Webpack Alioss Plugin
阿里 oss-webpack 自动上传插件
Stars: ✭ 35 (-98.23%)
Mutual labels:  webpack, plugin
Award
⚙基于react的服务端渲染框架
Stars: ✭ 91 (-95.4%)
Mutual labels:  webpack, plugin
Offline Plugin
Offline plugin (ServiceWorker, AppCache) for webpack (https://webpack.js.org/)
Stars: ✭ 4,444 (+124.44%)
Mutual labels:  webpack, plugin
Webpack Format Messages
Beautiful formatting for Webpack messages; ported from Create React App!
Stars: ✭ 103 (-94.8%)
Mutual labels:  webpack, stats
Wordless
All the power of Pug, Sass, Coffeescript and WebPack in your WordPress theme. Stop writing themes like it's 1998.
Stars: ✭ 1,374 (-30.61%)
Mutual labels:  webpack, plugin
Skpm
💎📦 A utility to build and publish Sketch plugins
Stars: ✭ 890 (-55.05%)
Mutual labels:  webpack, plugin
Webpack Plugin Hash Output
Plugin to replace webpack chunkhash with an md5 hash of the final file conent.
Stars: ✭ 128 (-93.54%)
Mutual labels:  webpack, plugin
Slinky
A light-weight, responsive, mobile-like navigation menu plugin
Stars: ✭ 649 (-67.22%)
Mutual labels:  webpack, plugin
Dotenv Webpack
A secure webpack plugin that supports dotenv and other environment variables and only exposes what you choose and use.
Stars: ✭ 1,022 (-48.38%)
Mutual labels:  webpack, plugin
Whybundled
Answers the question – Why the hell is this module in a bundle?
Stars: ✭ 477 (-75.91%)
Mutual labels:  webpack, stats
Serverless Plugin Webpack
Serverless Plugin Webpack
Stars: ✭ 72 (-96.36%)
Mutual labels:  webpack, plugin
Serviceworker Webpack Plugin
Simplifies creation of a service worker to serve your webpack bundles. ♻️
Stars: ✭ 454 (-77.07%)
Mutual labels:  webpack, plugin
Webpack Parallel Uglify Plugin
A faster uglifyjs plugin.
Stars: ✭ 456 (-76.97%)
Mutual labels:  webpack, plugin
Fork Ts Checker Webpack Plugin
Webpack plugin that runs typescript type checker on a separate process.
Stars: ✭ 1,343 (-32.17%)
Mutual labels:  webpack, plugin
Webapp Webpack Plugin
[DEPRECATED] use favicons-webpack-plugin instead
Stars: ✭ 127 (-93.59%)
Mutual labels:  webpack, plugin

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-dev speed-measure-webpack-plugin

or

yarn add -D speed-measure-webpack-plugin

Requirements

SMP requires at least Node v6. But otherwise, accepts all webpack versions (1, 2, 3, and 4).

Usage

Change your webpack config from

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

to

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

const smp = new SpeedMeasurePlugin();

const webpackConfig = smp.wrap({
  plugins: [new MyPlugin(), new MyOtherPlugin()],
});

and you're done! SMP will now be printing timing output to the console by default.

Check out the examples folder for some more examples.

Options

Pass these into the constructor, as an object:

const smp = new SpeedMeasurePlugin(options);

options.disable

Type: Boolean
Default: false

If truthy, this plugin does nothing at all.

{ disable: !process.env.MEASURE } allows opt-in measurements with MEASURE=true npm run build.

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, and output the response

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.pluginNames

Type: Object
Default: {}

By default, SMP derives plugin names through plugin.constructor.name. For some plugins this doesn't work (or you may want to override this default). This option takes an object of pluginName: PluginConstructor, e.g.

const uglify = new UglifyJSPlugin();
const smp = new SpeedMeasurePlugin({
  pluginNames: {
    customUglifyName: uglify,
  },
});

const webpackConfig = smp.wrap({
  plugins: [uglify],
});

options.loaderTopFiles

Type: Number
Default: 0

You can configure SMP to include the files that take the most time per loader, when using outputFormat: 'humanVerbose'. E.g., to show the top 10 files per loader:

const smp = new SpeedMeasurePlugin({
  outputFormat: "humanVerbose",
  loaderTopFiles: 10,
});

options.compareLoadersBuild

Type: Object
Default: {}

This option gives you a comparison over time of the module count and time spent, per loader. This option provides more data when outputFormat: "humanVerbose".

Given a required filePath to store the build information, this option allows you to compare differences to your codebase over time. E.g.

const smp = new SpeedMeasurePlugin({
  compareLoadersBuild: {
    filePath: "./buildInfo.json",
  },
});

options.granularLoaderData (experimental)

Type: Boolean
Default: false

By default, SMP measures loaders in groups. If truthy, this plugin will give per-loader timing information.

This flag is experimental. Some loaders will have inaccurate results:

  • loaders using separate processes (e.g. thread-loader)
  • loaders emitting file output (e.g. file-loader)

We will find solutions to these issues before removing the (experimental) flag on this option.

FAQ

What does general output time mean?

This tends to be down to webpack reading in from the file-system, but in general it's anything outside of what SMP can actually measure.

What does modules without loaders mean?

It means vanilla JS files, which webpack can handle out of the box.

Contributing

Contributors are welcome! 😊

Please check out the CONTRIBUTING.md.

Migrating

SMP follows semver. If upgrading a major version, you can consult the migration guide.

License

MIT

Contributors

Thanks goes to these wonderful people (emoji key):


Stephen Cook

💻 📖 📝 🎨 💬 👀

scarletsky

💻

牛さん

💻 🐛

Thomas Bentkowski

📖

Alan Agius

💻 🐛

Ximing

💻 🐛

Tan Li Hau

💻 🐛 ⚠️

Björn Brauer

💻 🐛

Suraj Patel

💻

Jm

💻 🐛 ⚠️

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].