  \doxysection*{Speed Measure Plugin \textsuperscript{{\itshape (for webpack)}} }



 \href{https://travis-ci.org/stephencookdev/speed-measure-webpack-plugin}{\texttt{ }} \href{https://npmjs.com/package/speed-measure-webpack-plugin}{\texttt{ }} \href{https://npmjs.com/package/speed-measure-webpack-plugin}{\texttt{ }} \href{https://github.com/prettier/prettier}{\texttt{ }}  ~\newline


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\+:

\hypertarget{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28646}{}\doxysubsection{Install}\label{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28646}

\begin{DoxyCode}{0}
\DoxyCodeLine{npm install -\/-\/save-\/dev speed-\/measure-\/webpack-\/plugin }

\end{DoxyCode}


or


\begin{DoxyCode}{0}
\DoxyCodeLine{yarn add -\/D speed-\/measure-\/webpack-\/plugin }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28647}{}\doxysubsection{Requirements}\label{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28647}
SMP requires at least {\bfseries{Node v6}}. But otherwise, accepts {\bfseries{all webpack}} versions (1, 2, 3, and 4).\hypertarget{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28648}{}\doxysubsection{Usage}\label{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28648}
Change your webpack config from


\begin{DoxyCode}{0}
\DoxyCodeLine{const webpackConfig = \{}
\DoxyCodeLine{  plugins: [}
\DoxyCodeLine{    new MyPlugin(),}
\DoxyCodeLine{    new MyOtherPlugin()}
\DoxyCodeLine{  ]}
\DoxyCodeLine{\} }

\end{DoxyCode}


to


\begin{DoxyCode}{0}
\DoxyCodeLine{const SpeedMeasurePlugin = require("{}speed-\/measure-\/webpack-\/plugin"{});}
\DoxyCodeLine{}
\DoxyCodeLine{const smp = new SpeedMeasurePlugin();}
\DoxyCodeLine{}
\DoxyCodeLine{const webpackConfig = smp.wrap(\{}
\DoxyCodeLine{  plugins: [}
\DoxyCodeLine{    new MyPlugin(),}
\DoxyCodeLine{    new MyOtherPlugin()}
\DoxyCodeLine{  ]}
\DoxyCodeLine{\}); }

\end{DoxyCode}


and you\textquotesingle{}re done! SMP will now be printing timing output to the console by default.

Check out the \href{/examples}{\texttt{ examples folder}} for some more examples.\hypertarget{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28649}{}\doxysubsection{Options}\label{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28649}
Pass these into the constructor, as an object\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{const smp = new SpeedMeasurePlugin(options); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28650}{}\doxysubsubsection{$<$tt$>$options.\+disable$<$/tt$>$}\label{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28650}
Type\+: {\ttfamily Boolean}~\newline
 Default\+: {\ttfamily false}

If truthy, this plugin does nothing at all.

{\ttfamily \{ disable\+: !process.env.\+MEASURE \}} allows opt-\/in measurements with {\ttfamily MEASURE=true npm run build}.\hypertarget{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28651}{}\doxysubsubsection{$<$tt$>$options.\+output\+Format$<$/tt$>$}\label{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28651}
Type\+: {\ttfamily String$\vert$\+Function}~\newline
 Default\+: {\ttfamily \char`\"{}human\char`\"{}}

Determines in what format this plugin prints its measurements


\begin{DoxyItemize}
\item {\ttfamily \char`\"{}json\char`\"{}} -\/ produces a JSON blob
\item {\ttfamily \char`\"{}human\char`\"{}} -\/ produces a human readable output
\item {\ttfamily \char`\"{}human\+Verbose\char`\"{}} -\/ produces a more verbose version of the human readable output
\item If a function, it will call the function with the JSON blob, and output the response
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28652}{}\doxysubsubsection{$<$tt$>$options.\+output\+Target$<$/tt$>$}\label{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28652}
Type\+: {\ttfamily String$\vert$\+Function}~\newline
 Default\+: {\ttfamily console.\+log}


\begin{DoxyItemize}
\item If a string, it specifies the path to a file to output to.
\item If a function, it will call the function with the output as the first parameter
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28653}{}\doxysubsubsection{$<$tt$>$options.\+plugin\+Names$<$/tt$>$}\label{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28653}
Type\+: {\ttfamily Object}~\newline
 Default\+: {\ttfamily \{\}}

By default, SMP derives plugin names through {\ttfamily plugin.\+constructor.\+name}. For some plugins this doesn\textquotesingle{}t work (or you may want to override this default). This option takes an object of {\ttfamily plugin\+Name\+: Plugin\+Constructor}, e.\+g.


\begin{DoxyCode}{0}
\DoxyCodeLine{const uglify = new UglifyJSPlugin();}
\DoxyCodeLine{const smp = new SpeedMeasurePlugin(\{}
\DoxyCodeLine{  pluginNames: \{}
\DoxyCodeLine{    customUglifyName: uglify}
\DoxyCodeLine{  \}}
\DoxyCodeLine{\});}
\DoxyCodeLine{}
\DoxyCodeLine{const webpackConfig = smp.wrap(\{}
\DoxyCodeLine{  plugins: [}
\DoxyCodeLine{    uglify}
\DoxyCodeLine{  ]}
\DoxyCodeLine{\}); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28654}{}\doxysubsubsection{$<$tt$>$options.\+granular\+Loader\+Data$<$/tt$>$ \+\_\+(experimental)\+\_\+}\label{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28654}
Type\+: {\ttfamily Boolean}~\newline
 Default\+: {\ttfamily false}

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

This flag is {\itshape experimental}. Some loaders will have inaccurate results\+:


\begin{DoxyItemize}
\item loaders using separate processes (e.\+g. {\ttfamily thread-\/loader})
\item loaders emitting file output (e.\+g. {\ttfamily file-\/loader})
\end{DoxyItemize}

We will find solutions to these issues before removing the \+\_\+(experimental)\+\_\+ flag on this option.\hypertarget{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28655}{}\doxysubsection{FAQ}\label{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28655}
\hypertarget{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28656}{}\doxysubsubsection{What does general output time mean?}\label{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28656}
This tends to be down to webpack reading in from the file-\/system, but in general it\textquotesingle{}s anything outside of what SMP can actually measure.\hypertarget{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28657}{}\doxysubsubsection{What does modules without loaders mean?}\label{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28657}
It means vanilla JS files, which webpack can handle out of the box.\hypertarget{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28658}{}\doxysubsection{Contributing}\label{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28658}
Contributors are welcome! 😊

Please check out the \mbox{\hyperlink{md_sfcode_node_modules_speed_measure_webpack_plugin_CONTRIBUTING}{CONTRIBUTING.md}}.\hypertarget{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28659}{}\doxysubsection{Migrating}\label{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28659}
SMP follows \href{https://semver.org/}{\texttt{ semver}}. If upgrading a major version, you can consult \mbox{\hyperlink{md_sfcode_node_modules_speed_measure_webpack_plugin_migration}{the migration guide}}.\hypertarget{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28660}{}\doxysubsection{License}\label{md_sfcode_node_modules_speed_measure_webpack_plugin_README_autotoc_md28660}
\href{/LICENSE}{\texttt{ MIT}} 